]> granicus.if.org Git - imagemagick/blobdiff - coders/txt.c
(no commit message)
[imagemagick] / coders / txt.c
index 7f762d28326b1eaae1fb08ad895603d832482928..52822789fe6126feaa3221675fc6d47c9749d1e6 100644 (file)
@@ -706,30 +706,33 @@ static MagickBooleanType WriteTXTImage(const ImageInfo *image_info,Image *image,
         break;
       for (x=0; x < (ssize_t) image->columns; x++)
       {
-        (void) FormatLocaleString(buffer,MaxTextExtent,"%.20g,%.20g ",(double)
-          x,(double) y);
-        (void) WriteBlobString(image,buffer);
         GetPixelInfoPixel(image,p,&pixel);
         if (pixel.colorspace == LabColorspace)
           {
             pixel.green-=(QuantumRange+1)/2.0;
             pixel.blue-=(QuantumRange+1)/2.0;
           }
-        if ((sparse_color != MagickFalse) &&
-            (GetPixelAlpha(image,p) == (Quantum) OpaqueAlpha))
+        if (sparse_color != MagickFalse)
           {
             /*
               Sparse-color format.
             */
-            (void) QueryColorname(image,&pixel,SVGCompliance,tuple,exception);
-            (void) WriteBlobString(image," ");
-            (void) WriteBlobString(image,buffer);
-            (void) WriteBlobString(image,tuple);
-            (void) WriteBlobString(image," ");
+            if (GetPixelAlpha(image,p) == (Quantum) OpaqueAlpha)
+              {
+                (void) QueryColorname(image,&pixel,SVGCompliance,tuple,
+                  exception);
+                (void) FormatLocaleString(buffer,MaxTextExtent,"%.20g,%.20g ",
+                  (double) x,(double) y);
+                (void) WriteBlobString(image,buffer);
+                (void) WriteBlobString(image,tuple);
+                (void) WriteBlobString(image," ");
+              }
             p+=GetPixelChannels(image);
             continue;
           }
-        (void) WriteBlobString(image,": ");
+        (void) FormatLocaleString(buffer,MaxTextExtent,"%.20g,%.20g: ",(double)
+          x,(double) y);
+        (void) WriteBlobString(image,buffer);
         (void) CopyMagickString(tuple,"(",MaxTextExtent);
         if (pixel.colorspace == GRAYColorspace)
           ConcatenateColorComponent(&pixel,GrayPixelChannel,X11Compliance,