logo       

Re: Fax compression in 6.0.8-3: msg#00006

video.image-magick.bugs

Subject: Re: Fax compression in 6.0.8-3

(Cc:'d to the magick-developers list, as followups probably belong there)

On Fri, 1 Oct 2004, Rob Foehl wrote:

I'm trying to convert a couple formats to TIFF for faxing using ImageMagick 6.0.8-3, and I can't seem to specify any compression types. For example:

$ convert -compress Fax -density 200x200 pdf:test.pdf tiff:test.tiff
$ identify -verbose test.tiff
Image: test.tiff
Format: TIFF (Tagged Image File Format)
Geometry: 1700x2200
Class: DirectClass
Colorspace: RGB
Type: Palette
Depth: 8 bits
Endianess: MSB
[...]
Rendering-intent: Undefined
Resolution: 200x200
Units: Undefined
Filesize: 10.7mb
Interlace: None
Background Color: white
Border Color: #DFDFDF
Matte Color: grey74
Dispose: Undefined
Iterations: 0
Compression: None
Orientation: TopLeft
Software: ImageMagick 6.0.8 10/01/04 Q16 http://www.imagemagick.org
Document: test.tiff
Comment: Image generated by GPL Ghostscript (device=pnmraw)


The same command used to work in 5.5.x. This is the first 6.0.x release I've tested. I found a possibly-related issue described here:

http://studio.imagemagick.org/magick/viewtopic.php?t=2314

No luck with either PerlMagick or the convert binary.

I tracked this one down... It's losing the compression setting because the input image isn't monochrome; this is also mentioned in the URL above.

5.5.7 coders/tiff.c looks like this around line 1656:

case FaxCompression:
{
SetImageType(image,BilevelType);
compress_tag=COMPRESSION_CCITTFAX3;
break;
}

Whereas 6.0.8 looks like this, line 1447:

case FaxCompression:
{
if (IsMonochromeImage(image,&image->exception) != MagickFalse)
compress_tag=COMPRESSION_CCITTFAX3;
break;
}

So, explicitly converting the image to monochrome should "fix" this..

$ convert -compress Fax -density 200x200 -monochrome pdf:test.pdf
tiff:test2.tiff
$ identify -verbose test2.tiff
Image: test2.tiff
Format: TIFF (Tagged Image File Format)
Geometry: 1700x2200
Class: PseudoClass
Colorspace: RGB
Type: Bilevel
Depth: 1 bits
Endianess: MSB
[...]
Histogram:
69605: ( 0, 0, 0) black
3670395: (255,255,255) white
Rendering-intent: Undefined
Resolution: 200x200
Units: Undefined
Filesize: 27kb
Interlace: None
Background Color: white
Border Color: #DFDFDF
Matte Color: grey74
Dispose: Undefined
Iterations: 0
Compression: Fax
Orientation: TopLeft
Software: ImageMagick 6.0.8 10/01/04 Q16 http://www.imagemagick.org
Document: test2.tiff
Comment: Image generated by GPL Ghostscript (device=pbmraw)


My question now is, why was this behavior changed? It seems natural that the image be converted to monochrome automatically (if necessary) when fax compression is requested, since it has to be monochrome; at the very least, this should probably generate an error rather than silently dropping the requested compression, IMHO.

Also having a separate PerlMagick order of operations problem with density settings. The following code properly sets density in the output:

my $img = Image::Magick->new();
$img->Set(density => '200x200');
$img->BlobToImage($pdf);
$img->Write('tiff:testpl.tiff');

Setting the density anywhere after the BlobToImage call does nothing. This issue (or similar) was mentioned here:

http://studio.imagemagick.org/pipermail/magick-bugs/2004-August/001827.html

Same question here still applies.

-Rob


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise