Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#5884 closed defect (fixed)

corrupted JPEG-encoded TIFFs

Reported by: cdestigter Owned by: Even Rouault
Priority: normal Milestone: 2.0.0
Component: GDAL_Raster Version: svn-trunk
Severity: normal Keywords: gtiff
Cc:

Description (last modified by cdestigter)

We've just upgraded to the latest trunk; many (all?) of our newly created JPEG-encoded TIFFs seem to be unreadable.

It seems to happen only when a mask band is present in the input image.

This occurs since r28208 - it works before that change and not afterwards.

$ rm -f check.* jpeg-encoded.*
$ gdal_translate -of GTiff -co TILED=YES -co COMPRESS=JPEG --config GDAL_TIFF_INTERNAL_MASK YES -co JPEG_QUALITY=85 -co ALPHA=PREMULTIPLIED -co PHOTOMETRIC=YCBCR tiny.tif jpeg-encoded.tif
Input file size is 106, 80
0...10...20...30...40...50...60...70...80...90...100 - done.

$ gdal_translate jpeg-encoded.tif check.tif
Input file size is 106, 80
0ERROR 1: JPEGLib:Huffman table 0x00 was not defined
ERROR 1: TIFFReadEncodedTile() failed.
ERROR 1: jpeg-encoded.tif, band 1: IReadBlock failed at X offset 0, Y offset 0
ERROR 1: GetBlockRef failed at X block offset 0, Y block offset 0

Trying -co JPEGTABLESMODE=0 (or 3) appears to avoid the problem, but I'm unfamiliar with what's going on there, so I don't know if that's a good workaround.

Attachments (1)

tiny.tif (25.7 KB ) - added by cdestigter 9 years ago.

Download all attachments as: .zip

Change History (6)

by cdestigter, 9 years ago

Attachment: tiny.tif added

comment:1 by cdestigter, 9 years ago

Description: modified (diff)

comment:2 by cdestigter, 9 years ago

(sample image is a waaay-downsampled tiny piece of this layer from Land Information New Zealand: https://koordinates.com/layer/3185-christchurch-post-earthquake-aerial-photos-24-feb-2011/ (licensed Creative Commons Attribution 3.0 NZ) )

comment:3 by cdestigter, 9 years ago

Description: modified (diff)

comment:4 by Even Rouault, 9 years ago

Resolution: fixed
Status: newclosed

trunk r28755 "GTiff (trunk only): correctly reset JPEGTABLESMODE state after writing internal mask to avoid generating corrupted image (#5884); on update of JPEG-in-TIFF images, do not generate optimized Huffman tables in each strile if there are already Huffman tables in JpegTables tag"

comment:5 by Even Rouault, 9 years ago

Milestone: 2.02.0.0

Milestone renamed

Note: See TracTickets for help on using tickets.