about summary refs log tree commit diff
path: root/converter
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2013-12-24 02:40:43 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2013-12-24 02:40:43 +0000
commit53b8f1a7e6c4210aa67e3028099300b486559543 (patch)
treeddb2eeb1929da57062056404356838160db2ece8 /converter
parent470372222f011c15be1b03f179ed0a26a5875830 (diff)
downloadnetpbm-mirror-53b8f1a7e6c4210aa67e3028099300b486559543.tar.gz
netpbm-mirror-53b8f1a7e6c4210aa67e3028099300b486559543.tar.xz
netpbm-mirror-53b8f1a7e6c4210aa67e3028099300b486559543.zip
Release 10.35.91
git-svn-id: http://svn.code.sf.net/p/netpbm/code/super_stable@2077 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter')
-rw-r--r--converter/pbm/pbmtoepsi.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/converter/pbm/pbmtoepsi.c b/converter/pbm/pbmtoepsi.c
index fc8cee7d..81e03fbe 100644
--- a/converter/pbm/pbmtoepsi.c
+++ b/converter/pbm/pbmtoepsi.c
@@ -150,6 +150,13 @@ findPrincipalImage(bit ** const bits,
             }
         }
     }
+
+    if(bottom == -MAXINT) {  /* No black pixels encountered */ 
+        pm_message("Blank page");
+        top = left = 0;
+        bottom = rows-1;  right = cols-1;
+	}
+
     *topP = top;
     *bottomP = bottom;
     *leftP = left;
@@ -237,13 +244,20 @@ main(int argc, char * argv[]) {
 
         for (row = top; row <= bottom; row++) {
             int col;
+	    int outChars = 2;
+	    printf("%% ");
 
-            printf("%% ");
+            for (col = left; col <= right; col += 8) {
+                if (outChars == 72) {
+		  printf("\n%% ");
+                  outChars = 2;
+		}  
 
-            for (col = left; col <= right; col += 8) 
                 printf("%02x", eightPixels(bits, row, col, cols));
-
-            printf("\n");
+                outChars += 2;
+	    }
+	    if (outChars > 0)
+                printf("\n");
         }
         printf("%%%%EndImage\n");
         printf("%%%%EndPreview\n");