Closed
Description
Bug report
Describe the bug
I try to re-compress an image in zip with --predictor
set to horizontal
as in
vips tiffsave GitHub-Mark.png vips_horizontal.tif --compression deflate --predictor horizontal
but it's seems to be ignored in the output image:
$ tiffinfo vips_horizontal.tif
TIFF Directory at offset 0x3b3c (15164)
Image Width: 560 Image Length: 560
Resolution: 28.34, 28.34 pixels/cm
Bits/Sample: 8
Sample Format: unsigned integer
Compression Scheme: AdobeDeflate
Photometric Interpretation: RGB color
Orientation: row 0 top, col 0 lhs
Samples/Pixel: 3
Rows/Strip: 128
Planar Configuration: single image plane
And no matter --predictor horizontal
or --predictor none
, they output the same file size, as if they were compressed without setting a predictor.
To Reproduce
Steps to reproduce the behavior:
- use image: https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png
vips tiffsave GitHub-Mark.png vips_horizontal.tif --compression deflate --predictor horizontal
tiffinfo vips_horizontal.tif
vips tiffsave GitHub-Mark.png vips_none.tif --compression deflate --predictor none
Expected behavior
- Should see
Predictor: horizontal differencing 2 (0x2)
in thetiffinfo
output - vips_horizontal.tif & vips_none.tif should have different sizes (in most cases)
Actual behavior
- No
Predictor: horizontal differencing 2 (0x2)
in thetiffinfo
output - vips_horizontal.tif & vips_none.tif have the same size
Environment
Linux 5.11.2-arch1-1
$ pacman -Q libtiff libvips imagemagick
libtiff 4.2.0-1
libvips 8.10.3-1
imagemagick 7.0.11.2-1
Additional context
As a comparison, use ImageMagick:
magick convert GitHub-Mark.png -compress zip -define tiff:predictor=2 gm_horizontal.tif
Could see the Predictor
filed is set,
$ tiffinfo gm_horizontal.tif
TIFF Directory at offset 0x2494 (9364)
Image Width: 560 Image Length: 560
Bits/Sample: 8
Compression Scheme: AdobeDeflate
Photometric Interpretation: palette color (RGB from colormap)
FillOrder: msb-to-lsb
Orientation: row 0 top, col 0 lhs
Samples/Pixel: 1
Rows/Strip: 560
Planar Configuration: single image plane
Page Number: 0-1
Color Map: (present)
White Point: 0.3127-0.329
PrimaryChromaticities: 0.640000,0.330000,0.300000,0.600000,0.150000,0.060000
Predictor: horizontal differencing 2 (0x2)
And the generated image sizes are different: (with respect to -define tiff:predictor=1
)
$ ls -l gm_horizontal.tif gm_none.tif
-rw-r--r-- 1 adios adios 11174 Mar 4 04:18 gm_horizontal.tif
-rw-r--r-- 1 adios adios 9892 Mar 4 04:29 gm_none.tif
Additional context 2
I encountered this issue on Ubuntu (with homebrew) at beginning, and then I started a VM to install Arch to test and report the issue.