---
milena/ChangeLog | 5 +++++
milena/mln/io/magick/save.hh | 15 ++++++++++++---
2 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index f853179..8e43f9f 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,8 @@
+2010-11-25 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ * mln/io/magick/save.hh: Fix a crash when using GraphicsMagick
+ instead of ImageMagick.
+
2010-11-19 Guillaume Lazzara <z(a)lrde.epita.fr>
Add a fastest implementation in io::magick.
diff --git a/milena/mln/io/magick/save.hh b/milena/mln/io/magick/save.hh
index 7282414..2ea2957 100644
--- a/milena/mln/io/magick/save.hh
+++ b/milena/mln/io/magick/save.hh
@@ -158,12 +158,21 @@ namespace mln
ncols = geom::ncols(ima),
nrows = geom::nrows(ima);
-
- Magick::Image magick_ima;
// In the construction of a Geometry object, the width (i.e.
// `ncols') comes first, then the height (i.e. `nrows')
// follows.
- magick_ima.size(Magick::Geometry(ncols, nrows));
+ //
+ // FIXME: Default pixel value is set to "white". If the image is
+ // declared with the default constructor, without specifying a
+ // default value, no data seems to be allocated and the Pixel view
+ // declared further fails and segfault...
+ Magick::Image magick_ima(Magick::Geometry(ncols, nrows), "white");
+
+ magick_ima.type(Magick::TrueColorType);
+
+ // Ensure that there is only one reference to underlying image
+ // If this is not done, then image pixels will not be modified.
+ magick_ima.modifyImage();
Magick::Pixels view(magick_ima);
// As above, `ncols' is passed before `nrows'.
--
1.5.6.5
Show replies by date