Opened 8 years ago

Closed 7 years ago

#6677 closed task (worksforme)

CreateCopy() fail to create a 4 bands image for GeoTiff compressed JPEG

Reported by: nejia Owned by: warmerdam
Priority: normal Milestone:
Component: GDAL_Raster Version: 2.0.2
Severity: normal Keywords:
Cc:

Description

I tried to create a Byte image from an input UInt16 image with 4 bands, I used the following options:
"COMPRESS=JPEG", "BIGTIFF=IF_SAFER", "TILED=YES"

you can reproduce the bug using:
gdal_translate -ot Byte -co "COMPRESS=JPEG" -co "BIGTIFF=IF_SAFER" -co "TILED=YES" IMG_LZW.TIF IMG_enhance.tif

Attachments (1)

IMG_LZW.7z (785.5 KB ) - added by nejia 8 years ago.
file to use for test

Download all attachments as: .zip

Change History (7)

by nejia, 8 years ago

Attachment: IMG_LZW.7z added

file to use for test

comment:1 by Jukka Rahkonen, 8 years ago

Works for me on Windows with GDAL 2.2.0dev, released 2016/99/99 Repeated your command and the result is:

gdalinfo img_enhance.tif
Driver: GTiff/GeoTIFF
Files: img_enhance.tif
Size is 3003, 6231
Coordinate System is `'
Metadata:
  TIFFTAG_DATETIME=2016:04:18 09:41:15
  TIFFTAG_IMAGEDESCRIPTION=B2, B1, B0, B3
  TIFFTAG_XRESOLUTION=1
  TIFFTAG_YRESOLUTION=1
Image Structure Metadata:
  COMPRESSION=JPEG
  INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0, 6231.0)
Upper Right ( 3003.0,    0.0)
Lower Right ( 3003.0, 6231.0)
Center      ( 1501.5, 3115.5)
Band 1 Block=256x256 Type=Byte, ColorInterp=Red
  Mask Flags: PER_DATASET ALPHA
Band 2 Block=256x256 Type=Byte, ColorInterp=Green
  Mask Flags: PER_DATASET ALPHA
Band 3 Block=256x256 Type=Byte, ColorInterp=Blue
  Mask Flags: PER_DATASET ALPHA
Band 4 Block=256x256 Type=Byte, ColorInterp=Alpha

I appreciate your small test data and command that works as is for testing. However, instead of creating a ticket about something that perhaps is not a bug, it would have been better to send mail to the gdal-dev list first.

Also, having 4 bands in JPEG is a bit peculiar and not so often supported in software. Discussion about this in http://osgeo-org.1560.x6.nabble.com/gdal-dev-Creating-jpeg-compressed-tiff-with-alpha-td4985300.html.

Last edited 8 years ago by Jukka Rahkonen (previous) (diff)

comment:2 by Even Rouault, 8 years ago

Works for me on Linux 64 bit with trunk and latest state of 2.0 branch (2.0.4dev). Works also on Windows 32 bit with trunk. Perhaps try upgrading ?

in reply to:  2 ; comment:3 by nejia, 8 years ago

Replying to rouault:

Works for me on Linux 64 bit with trunk and latest state of 2.0 branch (2.0.4dev). Works also on Windows 32 bit with trunk. Perhaps try upgrading ?

on Windows 32 bit with trunk:

gdalinfo --version

GDAL 2.2.0dev, released 2016/99/99

gdal_translate -ot Byte -co "COMPRESS=JPEG" -co "BIGTIFF=IF_SAFER" -co "TILED=YES" IMG_LZW.TIF IMG_enhance.tif

Input file size is 3003, 6231
0ERROR 1: JPEGLib:Bogus input colorspace
ERROR 1: JPEGLib:Bogus input colorspace
...10...20...30...40...50...60...ERROR 1: JPEGLib:Bogus input colorspace
ERROR 1: An error occurred while writing a dirty block
ERROR 1: JPEGLib:Bogus input colorspace
ERROR 1: JPEGLib:Bogus input colorspace
ERROR 1: WriteEncodedTile/Strip?() failed.
ERROR 1: JPEGLib:Bogus input colorspace
ERROR 1: WriteEncodedTile/Strip?() failed.
ERROR 1: JPEGLib:Bogus input colorspace

in reply to:  3 ; comment:4 by Even Rouault, 8 years ago

on Windows 32 bit with trunk:

Self built / or pre-built ? With which compilation options: internal vs external libjpeg ? which libjpeg version ?

in reply to:  4 comment:5 by nejia, 8 years ago

Self built / or pre-built ? With which compilation options: internal vs external libjpeg ? which libjpeg version ?

pre-build installed with OSGeo4W net release setup program
libjpeg 6b-5
libtiff 4.0.2-2

Last edited 8 years ago by nejia (previous) (diff)

comment:6 by Even Rouault, 7 years ago

Resolution: worksforme
Status: newclosed

I believie this is an issue in the OSGeo4W binary build, and not in GDAL sources themselves. Closing

Note: See TracTickets for help on using tickets.