Page 1 of 1

TIFF Compression

Posted: 2009-04-03T00:57:31-07:00
by MGSteve
I'm generating a 3355 x 2410 image and I need to have layers in the image, so as IM can't create layers within the PSD format at the moment, I'm having to use TIFF.

Problem is, it doens't seem to want to use a compression format at all.

Here's the code, but whatever compression format I try and use, it turns out a 48MB file.

Code: Select all

        $wPreview = $Preview->GenerateMaster($MasterFile,$ImageSetup->Fields,false);
        $Res = MagickSetImageFormat($wPreview,'TIFF');
        $Res = MagickSetImageCompression($wPreview,MW_ZIPCompression);
Any idea as to why it won't accept any compression settings?

Re: TIFF Compression

Posted: 2009-04-03T01:12:22-07:00
by MGSteve
Also, if I manually convert the output (i.e. convert 25-23-production.tiff -compress lzw test.tiff) then it works fine, both with LZW and ZIP compression.

It just fails to use any compression when saving through MagickWand. The call to MagickSetImageCompression return true, by the way.

Re: TIFF Compression

Posted: 2009-04-03T09:24:01-07:00
by magick
The following code returned LZW and Zip compression for us as expected. We're using ImageMagick 6.5.1-0 and MagickWand for PHP 1.0.8:

  • tiffinfo production.tiff
    TIFF Directory at offset 0x22b0 (8880)
    Image Width: 70 Image Length: 46
    Resolution: 72, 72 pixels/inch
    Bits/Sample: 8
    Compression Scheme: LZW
    Photometric Interpretation: RGB color
    FillOrder: msb-to-lsb
    Orientation: row 0 top, col 0 lhs
    Samples/Pixel: 3
    Rows/Strip: 39
    Planar Configuration: single image plane
    Page Number: 0-1
    DocumentName: production.tiff
    Software: ImageMagick 6.5.1-1 2009-04-02 Q16 OpenMP
    Predictor: horizontal differencing 2 (0x2)

Code: Select all

   $magick_wand = NewMagickWand();
   $status = MagickReadImage($magick_wand,'rose.jpg');
   if ($status == 0) {
     echo 'Error 1: '.MagickGetExceptionString($magick_wand);
   $status = MagickSetImageFormat($magick_wand,'TIFF');
   if ($status == 0) {
     echo 'Error 2: '.MagickGetExceptionString($magick_wand);
   $status = MagickSetImageCompression($magick_wand,MW_LZWCompression);
   if ($status == 0) {
     echo 'Error 3: '.MagickGetExceptionString($magick_wand);
   $status = MagickWriteImage($magick_wand,"production.tiff");
   if ($status == 0) {
     echo 'Error 4: '.MagickGetExceptionString($magick_wand);