diff options
Diffstat (limited to 'converter/pbm')
-rw-r--r-- | converter/pbm/pbmtoepsi.c | 22 |
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"); |