From b43c7cd316153c02367930241a720bf3e4d61f3f Mon Sep 17 00:00:00 2001 From: "Marcos H. Woehrmann" Date: Fri, 9 Mar 2012 13:53:55 -0800 Subject: 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. --- gs/base/gdevtsep.c | 18 ++++++++++-------- gs/doc/Devices.htm | 13 +++++++------ 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:
Produces 64-bit CMYK output (16 bits per component).
tiffsep
-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 lzw but this +may be overridden by the -sCompression= option.

The file specified via the OutputFile command line parameter will contain @@ -590,9 +591,9 @@ devices with:

-For the tiffsep device, it only changes the compression scheme -of the separation files (which is lzw by default), not the -composite cmyk file. It defaults to g4 for the +For the tiffsep device, it changes the compression scheme +of the separation files and composite cmyk file (which is +lzw by default). It defaults to g4 for the tiffsep1 device.

-- cgit v1.2.3