-
-
Notifications
You must be signed in to change notification settings - Fork 665
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
Saving a greyscale tiff pyramid fails to add predictor tags at lower levels #3808
Comments
A fix might be this diff
But I'm not understanding why writing the prediction tag was removed for the webp and zstd compression formats, so don't know if that should be changed back, too. |
Hi @manthey, Thanks for reporting this. I think I thought those were pseudotags rather than real tags, so they were no longer necessary now we copy compressed tiles. You're right, they should go back. I'll add a test for this case as well. |
We were not copying `TIFFTAG_PREDICTOR` when we copied tiff levels. see #3808 thanks manthey
It seems This will be in 8.15.2. I credited you in the changelog, I hope that's OK. |
(and thanks again for reporting this dumb thing!) |
Thank you. |
IIUC, I think the first part of the patch mentioned in comment #3808 (comment) is still needed. @@ -684,7 +684,7 @@ wtiff_compress_jpeg_header(Wtiff *wtiff,
jpeg_set_defaults(cinfo);
// use RGB mode (no chroma subsample) for high Q
- if (wtiff->Q >= 90)
+ if (wtiff->Q >= 90 && image->Bands == 3)
jpeg_set_colorspace(cinfo, JCS_RGB);
/* Set compression quality. Must be called after setting params above. (perhaps |
John thanks for responding / fixing this so quickly.. and your definition of dumb is not exactly the universe's definition of dumb.. :-) |
You're right, the |
Bug report
Describe the bug
If I have a greyscale image and run
vips tiffsave <infile> <out>.tif --tile --tile-width 256 --tile-height 256 --pyramid --compression lzw --predictor horizontal
, the first IFD says it uses horizontal prediction, but all lower resolution IFDs DO NOT SET the predictor tag (0x13D), but DO use horizontal prediction.To Reproduce
Steps to reproduce the behavior:
vips tiffsave <infile> <out>.tif --tile --tile-width 256 --tile-height 256 --pyramid --compression lzw --predictor horizontal
Expected behavior
The predictor tag to be set on all IFDs
Actual behavior
The predictor tag is missing on all IFDs except the first one.
Environment
Additional context
A git bisect with my local build looks like the error was introduced in 04819e1.
The removal of these lines is the problem:
04819e1#diff-4f72fc0bfd65090427bffb48f08db90829bfa4278fbd8d2cb57b3bf8d7faea38L2383-L2386
Further, this line:
04819e1#diff-4f72fc0bfd65090427bffb48f08db90829bfa4278fbd8d2cb57b3bf8d7faea38R687-R688
breaks outputting greyscale images to jpeg compression with high Q values as setting to RGB color space will fail on a 1 band image.
The text was updated successfully, but these errors were encountered: