scene and number_scenes ignored by ImageMagick 6.5.4-10
Posted: 2009-08-14T16:14:41-07:00
I've been using RMagick with ImageMagick 6.5.1 and I've been using BlobToImage (via ImageList#from_blob) with setting info.scene and info.number_scenes (usually just to 0 and 1 respectively). This worked find, but as soon as I tried upgrading to ImageMagick 6.5.4 it stopped working, and I was getting many images instead of just one (which, for a psd with 22 layers takes A LOT MORE time than I'd like). I traced it to CloneImageInfo, where scene and number_scenes are blatantly overwritten by DEPRECATED subimage and subrange (it seems that RMagick believed in this deprecation and does not allow setting neither subimage or subrange, scene and number_scenes are the only members exposed to ruby). I think that this should either be the other way around (subimage and subrange is set from scene and number_scenes), or like this:
Or, if the intention was to support legacy code, then maybe it should be something like this:
Now subimage and subrange would only be used when scene and number_scenes is not set to something explicitly.
Please fix this, because as it is in 6.5.4-10, the code that actually uses new members is punished, while code that uses deprecated subimage/subrange is unaffected.
Code: Select all
diff --git a/magick/image.c b/magick/image.c
index 1abd8ac..fe71f8c 100644
--- a/magick/image.c
+++ b/magick/image.c
@@ -1186,8 +1186,8 @@ MagickExport ImageInfo *CloneImageInfo(const ImageInfo *image_info)
clone_info->temporary=image_info->temporary;
clone_info->adjoin=image_info->adjoin;
clone_info->antialias=image_info->antialias;
- clone_info->scene=image_info->subimage;
- clone_info->number_scenes=image_info->subrange;
+ clone_info->scene=image_info->scene;
+ clone_info->number_scenes=image_info->number_scenes;
clone_info->depth=image_info->depth;
if (image_info->size != (char *) NULL)
(void) CloneString(&clone_info->size,image_info->size);
Code: Select all
diff --git a/magick/image.c b/magick/image.c
index 1abd8ac..41e4529 100644
--- a/magick/image.c
+++ b/magick/image.c
@@ -1186,8 +1186,16 @@ MagickExport ImageInfo *CloneImageInfo(const ImageInfo *image_info)
clone_info->temporary=image_info->temporary;
clone_info->adjoin=image_info->adjoin;
clone_info->antialias=image_info->antialias;
- clone_info->scene=image_info->subimage;
- clone_info->number_scenes=image_info->subrange;
+ if (image_info->scene == 0 && image_info->number_scenes == 0)
+ {
+ clone_info->scene=image_info->subimage;
+ clone_info->number_scenes=image_info->subrange;
+ }
+ else
+ {
+ clone_info->scene=image_info->scene;
+ clone_info->number_scenes=image_info->number_scenes;
+ }
clone_info->depth=image_info->depth;
if (image_info->size != (char *) NULL)
(void) CloneString(&clone_info->size,image_info->size);
Please fix this, because as it is in 6.5.4-10, the code that actually uses new members is punished, while code that uses deprecated subimage/subrange is unaffected.