PhilterPaper / Perl-PDF-Builder

Extended version of the popular PDF::API2 Perl-based PDF library for creating, reading, and modifying PDF documents
https://www.catskilltech.com/FreeSW/product/PDF%2DBuilder/title/PDF%3A%3ABuilder/freeSW_full
Other
6 stars 7 forks source link

t/tiff.t fails some alpha tests with lcms2-2.13 #177

Closed ppisar closed 2 years ago

ppisar commented 2 years ago

After upgrading lcms2 from 2.12 to 2.13, t/tiff.t fails like this:

$ perl -Ilib t/tiff.t
1..19
ok 1 - '$pdf->image_tiff(filename)' isa 'PDF::Builder::Resource::XObject::Image::TIFF_GT'
ok 2 - Image from filename has a width
ok 3 - Add TIFF to PDF
ok 4 - '$pdf->image_tiff(filehandle)' isa 'PDF::Builder::Resource::XObject::Image::TIFF'
ok 5 - Image from filehandle has a width
ok 6 - '$pdf->image_tiff(), LZW compression' isa 'PDF::Builder::Resource::XObject::Image::TIFF_GT'
ok 7 - Add TIFF to PDF
ok 8 - Fail fast if the requested file doesn't exist
not ok 9 - alpha + flate
#   Failed test 'alpha + flate'
#   at t/tiff.t line 165.
#          got: '# ImageMagick pixel enumeration: 1000,100,255,graya
# 0,0: (0,0,0,255)  #000000FF  graya(0,1)
[...]
# 999,99: (255,255,255,255)  #FFFFFFFF  graya(255,1)
# '
ok 10 - G4 (not converted to flate)
ok 11 - single-strip lzw (not converted to flate) with GT
ok 12 - multi-strip lzw (not converted to flate) with GT
ok 13 - lzw+horizontal predictor (not converted to flate) with GT
not ok 14 - alpha + lzw
#   Failed test 'alpha + lzw'
#   at t/tiff.t line 301.
#          got: '# ImageMagick pixel enumeration: 1000,100,255,graya
# 0,0: (0,0,0,255)  #000000FF  graya(0,1)
[...]
# 999,99: (255,255,255,255)  #FFFFFFFF  graya(255,1)
# '
ok 15 - single-strip lzw (not converted to flate) without GT
ok 16 - lzw+horizontal predictor (not converted to flate) without GT
ok 17 # skip multi-strip lzw without GT is not currently supported
ok 18 - successfully read TIFF with colormap
ok 19 - bilevel and alpha when width not a whole number of bytes with GT
# Version: ImageMagick 6.9.12-37 Q16 x86_64 2022-01-29 https://imagemagick.org
# Copyright: (C) 1999-2021 ImageMagick Studio LLC
# License: https://imagemagick.org/script/license.php
# Features: Cipher DPC Modules OpenMP(4.5) 
# Delegates (built-in): bzlib cairo djvu fontconfig freetype gslib gvc jbig jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png ps raqm raw rsvg tiff webp wmf x xml zlib
# GPL Ghostscript 9.55.0 (2021-09-27)
# Copyright (C) 2021 Artifex Software, Inc.  All rights reserved.
# Looks like you failed 2 tests of 19.

There seems to be changes in lmcs-2.13 regarding alpha in TIFF:

2.13 Featured release
-----------------------
Added support for premultiplied alpha
tifficc can now handle alpha channels, both unassociated and premultiplied
Better documentation
CGATS parser can now deal with very long strings
Added Projects for Visual Studio 2020
Travis CI discontinued, GitHub actions used instead
Added a very preliminar meson build script (thanks to xclaesse)
Added ARM64 target to visual studio 2019 (thanks to gaborkertesz-linaro)
Added thread safe code to get time
Added automatic linear space detection 
Added cmsGetStageContextID function
Added cmsDetectRGBProfileGamma function
configure now accepts --without-fastfloat to turn plugin off
autogen.sh has now a --distclean toggle to get rid of all autotools generated files
Checked to work on STM32 Cortex-A, Cortex-M families
Bug & typos fixing (thanks to many reporters and contributors)
ppisar commented 2 years ago

This was a regression in lcms2. It was fixed in lcms2-2.13.1:

2.13.1 Hot fix
-----------------------
Fix for pure white going gray in grayscale transforms.

I confirm that PDF-Builder tests pass again. I'm sorry for bothering you.

PhilterPaper commented 2 years ago

Ah, that's good news! Always a pleasure when something fixes itself. I'll cc @carygravel on this so he's aware.