Should ReadGIFImage() call DecodeImage() when pinged?

"Mark Stemm" <[email protected]>
Newsgroups gmane.comp.video.image-magick.devel
Message-ID <723504D812FBEF4F89F958B14D294EB2024D2C78@EXCH-C1.corp.cloudmark.com>
Hi, thanks for writing the excellent library ImageMagick, it's very
useful.

I had a question about the gif coder, specifically whether or not
ReadGIFImage() should call DecodeImage() when an image is pinged via
PingImage(). From what I can tell, DecodeImage reads the pixels out of
the image using GetImagePixels() and saves them to the pixel cache using
SyncImagePixels(). If my understanding is correct, it seems appropriate
to skip this step when the image is pinged.

Here's a diff to gif.c in 6.3.1 that would only call DecodeImage when
the image is read (i.e. not when pinged). If my understanding about when
DecodeImage() should be called is incorrect, please let me know.
Otherwise, let me know if this change looks acceptable.

  --Mark


--- coders/gif.c	8 Jan 2007 17:23:20 -0000	1.1.1.1
+++ coders/gif.c	23 Jan 2007 18:58:06 -0000
@@ -1218,13 +1218,17 @@ static Image *ReadGIFImage(const ImageIn
     /*
       Decode image.
     */
+    if (image_info->ping == MagickFalse)
+    {
     status=DecodeImage(image,(Quantum) opacity);
-    if ((image_info->ping == MagickFalse) && (status == MagickFalse))
+
+        if (status == MagickFalse)
       {
         global_colormap=(unsigned char *) RelinquishMagickMemory(
           global_colormap);
         ThrowReaderException(CorruptImageError,"CorruptImage");
       }
+    }
     if (image_info->number_scenes != 0)
       if (image->scene >=
(image_info->scene+image_info->number_scenes-1))
         break;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.