https://github.com/ImageMagick/ImageMagick/issues/561
diff --git a/coders/ps.c b/coders/ps.c
index db2260c..cf1eaf4 100644
--- a/coders/ps.c
+++ b/coders/ps.c
@@ -1153,7 +1153,7 @@
 {
 #define WriteRunlengthPacket(image,pixel,length,p) \
 { \
-  if ((image->alpha_trait != UndefinedPixelTrait) && \
+  if ((image->alpha_trait != UndefinedPixelTrait) && (length != 0) && \
       (GetPixelAlpha(image,p) == (Quantum) TransparentAlpha)) \
     { \
       q=PopHexPixel(hex_digits,0xff,q); \
@@ -1999,8 +1999,8 @@
           /*
             Dump DirectClass image.
           */
-          (void) FormatLocaleString(buffer,MagickPathExtent,"%.20g %.20g\n0\n%d\n",
-            (double) image->columns,(double) image->rows,
+          (void) FormatLocaleString(buffer,MagickPathExtent,
+            "%.20g %.20g\n0\n%d\n",(double) image->columns,(double) image->rows,
             compression == RLECompression ? 1 : 0);
           (void) WriteBlobString(image,buffer);
           switch (compression)