]> granicus.if.org Git - imagemagick/commitdiff
Fixed writing resolution info.
authordirk <dirk@git.imagemagick.org>
Tue, 11 Nov 2014 22:44:30 +0000 (22:44 +0000)
committerdirk <dirk@git.imagemagick.org>
Tue, 11 Nov 2014 22:44:30 +0000 (22:44 +0000)
coders/psd.c

index f12e7fbf0589529311ff6121a334bc67897ce77f..e8f5414961e33fcfec20fadab7ab7f98de605bc4 100644 (file)
@@ -2328,15 +2328,18 @@ static void WriteResolutionResourceBlock(Image *image)
   unsigned short
     units;
 
-  x_resolution=65536.0*image->resolution.x+0.5;
-  y_resolution=65536.0*image->resolution.y+0.5;
-  units=1;
   if (image->units == PixelsPerCentimeterResolution)
     {
-      x_resolution=2.54*65536.0*image->resolution.x*0.5;
+      x_resolution=2.54*65536.0*image->resolution.x+0.5;
       y_resolution=2.54*65536.0*image->resolution.y+0.5;
       units=2;
     }
+  else
+    {
+      x_resolution=65536.0*image->resolution.x+0.5;
+      y_resolution=65536.0*image->resolution.y+0.5;
+      units=1;
+    }
   (void) WriteBlob(image,4,(const unsigned char *) "8BIM");
   (void) WriteBlobMSBShort(image,0x03ED);
   (void) WriteBlobMSBShort(image,0);
@@ -2539,6 +2542,7 @@ static MagickBooleanType WritePSDImage(const ImageInfo *image_info,Image *image,
     {
       (void) WriteBlobMSBShort(image,(unsigned short) (image->storage_class ==
         PseudoClass ? 8 : image->depth > 8 ? 16 : 8));
+
       if (((image_info->colorspace != UndefinedColorspace) ||
            (image->colorspace != CMYKColorspace)) &&
           (image_info->colorspace != CMYKColorspace))