qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.52k stars 2.99k forks source link

Re: [Quantum GIS] #996: QGIS corrupts JPEG2000 colors #11056

Closed qgib closed 5 years ago

qgib commented 16 years ago

Author Name: coatman - (coatman -) Original Redmine Issue: 996

Redmine category:rasters Assignee: nobody -


Under Mac OS X, working with QGIS version 0.9.2, GDAL version 1.5.0, and Kakadu version 6.0, I built the gdal_JP2KAK.dylib Kakadu-based plugin that enables QGIS to read in JPEG2000 images. My web page http://homepage.mac.com/gregcoats/jp2.html shows that a simple example JPEG2000 image with red, green, blue, white, cyan, magenta, yellow, and black pixels is displayed by QGIS the same size as the original JPEG2000 image, but with drastically different colors. This is highly undesirable, and is not the fault of the Kakadu version 6.0 software. Further tests show that GDAL's gdal_translate is working properly with the gdal_JP2KAK.dylib plugin. A previous version of the gdal_JP2KAK.dylib, used with earlier versions of QGIS, GDAL, and Kakadu, worked fine. So, the problem is with the new version of QGIS.

qgib commented 15 years ago

Author Name: coatman - (coatman -)


The Quantum GIS Downloads web page offers 2 flavors of QGIS version 1.0.0-Kore-preview2 for Mac OS X. I have downloaded, installed, and used both. Unfortunately, both improperly display corrupt colors for JPEG2000 images, that are properly geo-referenced, and displayed with the proper number of columns and rows. This serious problem was reported here 10 months ago, and is extremely well documented at this web site http://homepage.mac.com/gregcoats/jp2.html

I was delighted that early releases of QGIS properly displayed JPEG2000 images. I strongly urge QGIS management to halt its practice of knowingly releasing versions of QGIS that display corrupt colors for JPEG2000 images, and to quickly restore to QGIS the ability to properly display the colors in JPEG2000 images. I have waited 10 months, and I have offered $2,500.00 for a version of QGIS, compatible with Mac OS X 10.5.5 and Kakadu 6.1.1, that would, like the early versions of QGIS, simply properly display the colors in JPEG2000 images, but QGIS remains unable to properly display JPEG2000 images.

qgib commented 15 years ago

Author Name: coatman - (coatman -)


Using the GDAL Jasper-based JPEG2000, and without using Kakadu, I used GDAL 1.6 gdal_translate to create from a [[GeoTIF]] a [[GeoJP]]2, and then to create from that [[GeoJP]]2 a [[GeoTIF]]. QGIS version 1.0.0-Kore-preview2, for Mac OS X 10.5, available from the Quantum GIS Downloads web site, and from the kyngchaos web site, both display the [[GeoTIF]] created by gdal_translate properly geo-referenced, with the proper number of columns and rows, but with the colors being ALL BLACK. Additionally, all of the other image viewing applications that I have display the [[GeoTIF]] created by gdal_translate as all black.

To summarize, I am reporting that a GeoTIF, created by gdal_translate from a [[GeoJP]]2 that gdal_translate created, is being displayed as all black, by QGIS and by 5 other image viewing applications.

The sample [[GeoTIF]], 800 columns by 100 rows, that gdal_translate converts to [[GeoJP]]2, can be downloaded from http://homepage.mac.com/gregcoats/jp2/images/rgbwcmyk01_YeGeo.tif

gdal_translate --version

GDAL 1.6.0, released 2008/12/04

gdal_translate --formats | grep 2000 JP2KAK (rw): JPEG-2000 (based on Kakadu)

JPEG2000 (rw): JPEG-2000 part 1 (ISO/IEC 15444-1)

gdal_translate -ot Byte -of JPEG2000 -co "FORMAT=JP2" -co "mode=int" rgbwcmyk01_YeGeo.tif rgbwcmyk01_YeGeo_GDAL16_JPEG2000.jp2

Input file size is 800, 100 0...10...20...30...40...50...60...70...80...90...100 - done.

export GDAL_SKIP=JP2KAK

gdal_translate -ot Byte -of GTiff -co "COMPRESS=NONE" rgbwcmyk01_YeGeo_GDAL16_JPEG2000.jp2 rgbwcmyk01_YeGeo_GDAL16_JPEG2000.tif

Input file size is 800, 100 0...10...20...30...40...50...60...70...80...90...100 - done.

qgib commented 15 years ago

Author Name: Jürgen Fischer (@jef-n)


Replying to [comment:52 Coatman]:

To summarize, I am reporting that a GeoTIF, created by gdal_translate from a [[GeoJP]]2 that gdal_translate created, is being displayed as all black, by QGIS and by 5 other image viewing applications.

So you also have verified that this is a GDAL and no QGIS bug. Therefore I'm tempted to close this ticket.

Please follow up the ticket you filed in the GDAL TRAC. Your latest comment looks like the explanation Frank Warmerdam requested there and I bet the GDAL developers are following their TRAC more closely than ours.

qgib commented 15 years ago

Author Name: coatman - (coatman -)


A byte by byte comparison of the original uncompressed .tif to the uncompressed .tif created by gdal_translate using Jasper, from a .jp2 created by gdal_translate from the original .tif, shows that the basic tiffinfo and listgeo metadata is identical (this is good). But od shows that this 800 column by 100 row by RGB image has 800 * 100 = 80,000 consecutive 00 00 00 pixel triples, representing black, which results in image viewing applications displaying the .tif created by gdal_translate as all black.

qgib commented 15 years ago

Author Name: coatman - (coatman -)


When gdal_translate depends upon Jasper based -of JPEG000 to read a .tif, write a .jp2, and then write a .tif, the final .tif contains all black pixels, but when gdal_translate depends upon Kakadu based -of JP2KAK to read a .tif, write a .jp2, and then write a .tif, the final .tif is properly written and properly displays with all of the image viewing applications I have. My GDAL has both Jasper JPEG2000 and Kakadu JP2KAK. With gdal_translate, when writing a .jp2, the user specifies the use of Jasper or Kakadu with -of JPEG2000 or -of JP2KAK. With gdal_translate, when reading a .jp2, the user specifies the use of Jasper or Kakadu with export GDAL_SKIP=JP2KAK or export GDAL_SKIP=JPEG2000.

I could use QGIS now if I knew how to specify to QGIS that it use Kakadu JP2KAK instead of using the default Jasper JPEG2000. Since gdal_translate Jasper JPEG2000 is not working, but gdal_translate Kakadu JP2KAK is working, P-L-E-A-S-E tell me

How to specify that QGIS use Kakadu JP2KAK, and not use Jasper JPEG2000?

Greg

gdal_translate -ot Byte -of JPEG2000 -co "mode=int" rgbwcmyk01_YeGeo.tif rgbwcmyk01_YeGeo_GDAL16_JPEG2000.jp2

export GDAL_SKIP=JP2KAK

gdal_translate -ot Byte -of GTiff -co "COMPRESS=NONE" rgbwcmyk01_YeGeo_GDAL16_JPEG2000.jp2 rgbwcmyk01_YeGeo_GDAL16_JPEG2000.tif

The resulting, Jasper dependent, .tif contains only all black pixels.

gdal_translate -ot Byte -of JP2KAK -co "QUALITY=100" rgbwcmyk01_YeGeo.tif rgbwcmyk01_YeGeo_GDAL16_JP2KAK.jp2

export GDAL_SKIP=JPEG2000

gdal_translate -ot Byte -of GTiff -co "COMPRESS=NONE" rgbwcmyk01_YeGeo_GDAL16_JP2KAK.jp2 rgbwcmyk01_YeGeo_GDAL16_JP2KAK.tif

The resulting, Kakadu dependent, .tif properly displays.

qgib commented 15 years ago

Author Name: Jürgen Fischer (@jef-n)


The jasper support in GDAL was fixed (see "GDAL Ticket #12459":http://trac.osgeo.org/gdal/ticket/2399) and updated GDAL package for Ubuntu is available on "launchpad":https://launchpad.net/~qgis/+archive.

I filed the new ticket #11534 with a request to make the gdal driver selectable.


qgib commented 15 years ago

Author Name: Jürgen Fischer (@jef-n)


Replying to [comment:56 jef]:

The jasper support in GDAL was fixed (see "GDAL Ticket #12459":http://trac.osgeo.org/gdal/ticket/2399) and updated GDAL package for Ubuntu is available on "launchpad":https://launchpad.net/~qgis/+archive.

I filed the new ticket #11534 with a request to make the gdal driver selectable.

Which was a duplicate of #10241

qgib commented 15 years ago

Author Name: coatman - (coatman -)


Regarding http://trac.osgeo.org/gdal/ticket/2732#comment:14

The color display problem with GDAL Kakadu based JP2KAK is fixed by changing line 1562 of jp2kakdataset.cpp from KDU_WANT_CODESTREAM_COMPONENTS); to KDU_WANT_OUTPUT_COMPONENTS);

I am pleased to report that, under Mac OS X 10.5, I changed, as directed, line 1562 of 1.6/gdal/frmts/jp2kak/jp2kakdataset.cpp and then built a new gdal_JP2KAK.dylib plugin. Now QGIS, using Kakadu based JP2KAK, properly displays JPEG2000 images.

So a new compilation of QGIS with the updated GDAL Kakadu based JP2KAK jp2kakdataset.cpp and the updated GDAL Jasper based JPEG2000 jpeg2000dataset.cpp provides two facilities for QGIS to properly display JPEG2000 images. The JP2KAK plugin for 32 bit and 64 bit Intel Macs can be downloaded from my web site. Hooray! Thanks!

qgib commented 15 years ago

Author Name: Anónimo (Anónimo)


Milestone Version 1.0.1 deleted