turbojpeg introduced support for abbreviated datastreams in 2.1.4, returning early from tjDecompressHeader3 if such a datastream is detected, and thus not updating the values for width, height colorspace and subsampling that we relied on.
This didn't cause issues with the standard ImageIO TIFFImageReader from the com.sun package, since it always completely decoded the JPEG. However, the TwelveMonkeys implementation was more efficient and only used the abbreviated datastream from the TIFF Header, as intended.
This broke our code, since we assumed that width, height, colorspace and subsampling were always available.
Luckily the fix was rather trivial: Simply check if the values were set tor not and return null if they weren't. The null info value doesn't cause any issues, since by the time the values are needed, we already have a new input with the full datastream available and will read the info from there.
turbojpeg introduced support for
abbreviated datastreams
in 2.1.4, returning early fromtjDecompressHeader3
if such a datastream is detected, and thus not updating the values for width, height colorspace and subsampling that we relied on.This didn't cause issues with the standard ImageIO
TIFFImageReader
from thecom.sun
package, since it always completely decoded the JPEG. However, the TwelveMonkeys implementation was more efficient and only used the abbreviated datastream from the TIFF Header, as intended.This broke our code, since we assumed that width, height, colorspace and subsampling were always available.
Luckily the fix was rather trivial: Simply check if the values were set tor not and return
null
if they weren't. Thenull
info value doesn't cause any issues, since by the time the values are needed, we already have a new input with the full datastream available and will read the info from there.