summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcos H. Woehrmann <marcos.woehrmann@artifex.com>2012-03-09 13:53:55 -0800
committerChris Liddell <chris.liddell@artifex.com>2012-03-15 11:54:24 +0000
commitb43c7cd316153c02367930241a720bf3e4d61f3f (patch)
tree754b29115d467f216ee956dde49cbf6f55e00c1d
parent23401e532f394b0fedf41ef97e2673d8a6f35b39 (diff)
Change compression of the tiffsep device composite output to match the separations.
Previous to this commit the tiffsep device would always write out an uncompressed composite file; the separation files were lzw compressed by default and this could be changed via the -sCompression= option. Now the compression of the composite file is the same as that of the separation files. Fixes Bug 692907.
-rw-r--r--gs/base/gdevtsep.c18
-rw-r--r--gs/doc/Devices.htm13
2 files changed, 17 insertions, 14 deletions
diff --git a/gs/base/gdevtsep.c b/gs/base/gdevtsep.c
index b10d8e051..330df2363 100644
--- a/gs/base/gdevtsep.c
+++ b/gs/base/gdevtsep.c
@@ -190,7 +190,7 @@ tiffgray_print_page(gx_device_printer * pdev, FILE * file)
gx_device_tiff *const tfdev = (gx_device_tiff *)pdev;
int code;
- if (pdev->height > ((long) 0xFFFFFFFF - ftell(file))/(pdev->width)) /* note width is never 0 in print_page */
+ if (tfdev->Compression==COMPRESSION_NONE && pdev->height > ((long) 0xFFFFFFFF - ftell(file))/(pdev->width)) /* note width is never 0 in print_page */
return_error(gs_error_rangecheck); /* this will overflow 32 bits */
code = gdev_tiff_begin_page(tfdev, file);
@@ -355,7 +355,7 @@ tiffcmyk_print_page(gx_device_printer * pdev, FILE * file)
gx_device_tiff *const tfdev = (gx_device_tiff *)pdev;
int code;
- if (pdev->height > ((long) 0xFFFFFFFF - ftell(file))/(pdev->width)) /* note width is never 0 in print_page */
+ if (tfdev->Compression==COMPRESSION_NONE && pdev->height > ((long) 0xFFFFFFFF - ftell(file))/(pdev->width)) /* note width is never 0 in print_page */
return_error(gs_error_rangecheck); /* this will overflow 32 bits */
code = gdev_tiff_begin_page(tfdev, file);
@@ -1582,9 +1582,8 @@ tiffsep_print_page(gx_device_printer * pdev, FILE * file)
/* Write the page directory for the CMYK equivalent file. */
pdev->color_info.depth = 32; /* Create directory for 32 bit cmyk */
- if (pdev->height > ((long) 0xFFFFFFFF - ftell(file))/(pdev->width*4)) /* note width is never 0 in print_page */
- {
- dprintf("CMYK composite file would be too large! Reduce resolution.\n");
+ if (tfdev->Compression==COMPRESSION_NONE && pdev->height > ((long) 0xFFFFFFFF - ftell(file))/(pdev->width*4)) { /* note width is never 0 in print_page */
+ dprintf("CMYK composite file would be too large! Reduce resolution or enable compression.\n");
return_error(gs_error_rangecheck); /* this will overflow 32 bits */
}
@@ -1594,7 +1593,10 @@ tiffsep_print_page(gx_device_printer * pdev, FILE * file)
return_error(gs_error_invalidfileaccess);
}
code = tiff_set_fields_for_printer(pdev, tfdev->tiff_comp, 1, 0);
- tiff_set_cmyk_fields(pdev, tfdev->tiff_comp, 8, COMPRESSION_NONE, tfdev->MaxStripSize);
+ if (tfdev->Compression==COMPRESSION_NONE || tfdev->Compression==COMPRESSION_LZW || tfdev->Compression==COMPRESSION_PACKBITS)
+ tiff_set_cmyk_fields(pdev, tfdev->tiff_comp, 8, tfdev->Compression, tfdev->MaxStripSize);
+ else
+ tiff_set_cmyk_fields(pdev, tfdev->tiff_comp, 8, COMPRESSION_LZW, tfdev->MaxStripSize);
pdev->color_info.depth = save_depth;
if (code < 0)
return code;
@@ -1638,8 +1640,8 @@ tiffsep_print_page(gx_device_printer * pdev, FILE * file)
pdev->color_info.depth = 8; /* Create files for 8 bit gray */
pdev->color_info.num_components = 1;
- if (pdev->height > ((long) 0xFFFFFFFF - ftell(file))/(pdev->width)) /* note width is never 0 in print_page */
- return_error(gs_error_rangecheck); /* this will overflow aax_long */
+ if (tfdev->Compression==COMPRESSION_NONE && pdev->height > ((long) 0xFFFFFFFF - ftell(file))/(pdev->width)) /* note width is never 0 in print_page */
+ return_error(gs_error_rangecheck); /* this will overflow 32 bits */
code = tiff_set_fields_for_printer(pdev, tfdev->tiff[comp_num], 1, 0);
tiff_set_gray_fields(pdev, tfdev->tiff[comp_num], 8, tfdev->Compression, tfdev->MaxStripSize);
diff --git a/gs/doc/Devices.htm b/gs/doc/Devices.htm
index 924cc8540..ebab696d2 100644
--- a/gs/doc/Devices.htm
+++ b/gs/doc/Devices.htm
@@ -381,9 +381,10 @@ drivers that produce uncompressed output:
<dd>Produces 64-bit CMYK output (16 bits per component).
<a name="tiffsep"></a><dt><code>tiffsep</code>
<dd>
-The tiffsep device creates multiple output files. The device creates a single
-32 bit composite CMYK file (tiff32nc format) and multiple tiffgray files.
-A tiffgray file compressed with LZW is created for each separation.
+The tiffsep device creates multiple output files: a single 32 bit
+composite CMYK file and multiple tiffgray files, one for each
+separation. The default compression is <code>lzw</code> but this
+may be overridden by the <code>-sCompression=</code> option.
<p>
The file specified via the OutputFile command line parameter will contain
@@ -590,9 +591,9 @@ devices with:
</blockquote>
<p>
-For the <code>tiffsep</code> device, it only changes the compression scheme
-of the separation files (which is <code>lzw</code> by default), not the
-composite cmyk file. It defaults to <code>g4</code> for the
+For the <code>tiffsep</code> device, it changes the compression scheme
+of the separation files and composite cmyk file (which is
+<code>lzw</code> by default). It defaults to <code>g4</code> for the
<code>tiffsep1</code> device.
<p>