Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Robert Sachunsky
olena
Commits
9d48f1d0
Commit
9d48f1d0
authored
Sep 27, 2019
by
Edwin Carlinet
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'handle-magick-exceptions' into 'master'
catch exceptions from Magick++: See merge request
olena/olena!2
parents
58d4f5df
49f31120
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
1 deletion
+18
-1
milena/mln/io/magick/load.hh
milena/mln/io/magick/load.hh
+18
-1
No files found.
milena/mln/io/magick/load.hh
View file @
9d48f1d0
...
...
@@ -153,7 +153,24 @@ namespace mln
// FIXME: Handle Magick++'s exceptions (see either
// ImageMagick++'s or GraphicsMagick++'s documentation).
Magick
::
Image
magick_ima
(
filename
);
magick_ima
.
read
(
filename
);
try
{
magick_ima
.
read
(
filename
);
}
catch
(
Magick
::
WarningCoder
&
warning
)
{
// Process coder warning while loading file (e.g. TIFF warning)
// Maybe the user will be interested in these warnings (or not).
// If a warning is produced while loading an image, the image
// can normally still be used (but not if the warning was about
// something important!)
std
::
cerr
<<
"warning: magick read: "
<<
warning
.
what
()
<<
std
::
endl
;
}
catch
(
Magick
::
Warning
&
warning
)
{
// Handle any other Magick++ warning.
std
::
cerr
<<
"warning: magick read: "
<<
warning
.
what
()
<<
std
::
endl
;
}
catch
(
Magick
::
ErrorFileOpen
&
error
)
{
// Process Magick++ file open error
std
::
cerr
<<
"error: magick read: "
<<
error
.
what
()
<<
std
::
endl
;
abort
();
}
magick_ima
.
type
(
Magick
::
TrueColorType
);
int
nrows
=
magick_ima
.
rows
();
int
ncols
=
magick_ima
.
columns
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment