Opened 17 years ago
Closed 17 years ago
#1796 closed defect (fixed)
[PATCH] JPEGCreateCopy and 1 band palette indexed
Reported by: | Even Rouault | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | 1.5.0 |
Component: | GDAL_Raster | Version: | svn-trunk |
Severity: | normal | Keywords: | jpeg |
Cc: |
Description
JPEGCreateCopy only checks for the number of source bands being 1 or 3 and maps 1 band to JCS_GRAYSCALE and 3 bands to JCS_RGB. This is really a minimal check. In the case we have only 1 band but whose color interpretation is GCI_PaletteIndex, we probably prefer to expand it as JCS_RGB rather than JCS_GRAYSCALE.
The enclosed patch implements this.
Attachments (1)
Change History (7)
by , 17 years ago
Attachment: | gdal_svn_jpeg_paletteindex.patch added |
---|
comment:1 by , 17 years ago
Component: | ConfigBuild → GDAL_Raster |
---|
comment:2 by , 17 years ago
comment:3 by , 17 years ago
Yes, I was expecting that this patch is arguable.
I shoud have asked first if there is a way with gdal utilities to do paletted to RGB conversion ? I'm not aware of one.
Another option, that could be probably generalized to other drivers (I can't think of other examples though) , would be to add a creation option like "CONVERT_PALETTE_TO_RGB_IF_NECESSARY".
comment:4 by , 17 years ago
Even,
The pct2rgb.py utility can be used to convert pseudocolored images to rgb 24bit 3 band images.
Rather than having drivers do the expansion, I'd rather add options to gdal_translate to do it outside the driver.
comment:6 by , 17 years ago
Milestone: | → 1.5.0 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Even,
It is not normal practice for drivers to do paletted to RGB conversion on the fly. I believe a more correct (though less useful) behavior is for the driver to issue either a warning or an error for paletted images. A warning should be issued if bStrict is FALSE, and an error if bStrict is TRUE. If an error is issued, the translation should terminate.
If you feel strongly about drivers doing on-the-fly palette expansion, then I would suggest you raise it as a discussion topic on the mailing list.