-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CTS 34] Error with TIFF with colormap #133
Comments
That's interesting. I ran it without any messages, although Adobe Reader says the PDF is corrupt and can't open it. The TIFF file is a scan of a diary entry about someone's colostomy (yecch), so that looks OK. None of the TIFF .pm files seem to have been changed for quite a few releases -- you haven't changed anything locally, have you? |
The reason I get an error message and you don't is that I am running with Graphics::TIFF and you are not. After some investigation, I see that Graphics::TIFF doesn't pass the colormap properly. I'll get a new release out and then make the appropriate fixes here. |
I do have Graphics::TIFF, so that can't be it. But if there's a problem with GT, someone will need to fix it. Are you running with a more recent version (development version) than I am? As I recall, my libtiff is what came with Strawberry Perl 5.26 and it hasn't been updated in almost 3 years or more. I have a ticket in with Graphics::TIFF (RT 132346) suggesting that an Alien::TIFF be created so as to keep libtiff up to date on non-Linux systems. |
Please don't confuse I understand why you like the idea of I will solve this problem with a new version of Graphics::TIFF. It will also need small changes to PDF::Builder. |
I realize that Graphics::TIFF is a wrapper around libtiff. I have both, and for a long time I have used Graphics::TIFF for TIFF processing (also testing without it). If you want to create an Alien::TIFF, I can't help much with developing/coding, but of course I have a Windows machine to test on. Are you working with Jeffrey Ratcliffe on this? He's the owner of Graphics::TIFF (or are you he?) or are you primarily on the libtiff side? |
OK, I merged your PR and cleaned up a few things (LAST_UPDATE version, tiff.t comments). In your new t/tiff.t test, I notice that you were not checking for Graphics::TIFF ( By the way, in Builder.pm I do some tests for Graphics::TIFF with |
That you still get the corrupt PDF I find worrying. What happens if you enable warnings by running with What version of libtiff do you have?
I'll look at your changes and add some stuff to the CI to additionally run the tests without Graphics::TIFF. |
No difference if I run with I don't think I explicitly installed libtiff.a. I think it came pre-installed with Strawberry Perl 5.26.1, January 2018. I did have to install Graphics::TIFF, in order to use it. I use |
I think that something like
will tell you which libtiff version you have. I suspect that your PDF viewer is stricter than mine, meaning the PDF produced by the colormap code is slightly broken, but readable by some viewers. I'll take another look at the colormap code and get back to you. |
OK, Graphics::TIFF itself is v7, and
Try::Tiny is not a core module -- are you saying that it ought to be? I view PDFs with Adobe Acrobat Reader DC (I think it's cloud-based) under Windows. |
One tool I've used for looking at the PDF produced from the TIFF with a colormap complains
If I add some debugging statements in TIFF.pm and TIFF_GT.pm and compare the size of the stream produce for the colormap for this tiff, I see that with and without Graphics::TIFF, the size of the streams is identical. Indeed, if I create the same PDF without Graphics::TIFF, the above tool makes exactly the same complaint. The palette code for PNG looks rather different. The resulting image object should be the same, though, irrelevant whether it came from TIFF or PNG, shouldn't it? If my above assumption is correct, then I'm guessing that TIFF.pm and TIFF_GT.pm are buggy in the same way. |
Well, the lookup table (a.k.a. colormap, palette?) is flate compressed... is it supposed to be uncompressed? I'll have to look at the size of the colormap before it's compressed, and see if it's complete. I vaguely recall PNG allowing a short palette if the missing entries weren't used; I'll have to see if the TIFF code is assuming the same thing here (and what the TIFF spec says about it). I don't recall rewriting the palette code when implementing Graphics::TIFF, so it's possible the same bug is in both versions. Once As you may have guessed by now, you're probably the first one to really exercise the TIFF code, and are finding all sorts of implementation problems that have been around for a decade or more. Compared to JPEG, GIF, and PNG; there's just not that much usage of TIFF images. I do appreciate the interest you're taking, and the help you're giving on this! |
Fixed by PR 137. Thanks! |
In the attached zip, when I run the following code, I get the error message
Can't use string ("1845184560") as an ARRAY ref while "strict refs" in use at /usr/share/perl5/PDF/Builder/Resource/XObject/Image/TIFF/File_GT.pm line 154.
I'll give you a pull request to fix this ASAP.
The text was updated successfully, but these errors were encountered: