Opened 11 years ago

Closed 5 years ago

#5133 closed enhancement (wontfix)

Add transparency handling to rgb2pct.py

Reported by: dal Owned by: warmerdam
Priority: normal Milestone: closed_because_of_github_migration
Component: Utilities Version: unspecified
Severity: normal Keywords: rgb2pct, transparency
Cc:

Description

I have a particular value marked as NODATA on my red, green and blue input bands and this is being ignored by rgb2pct.py. It would be great to change the code for building a PCT to ignore such pixels, and to add a transparent color if any are found, and then to make a change to the DitherRGB2PCT() code to keep track of that.

Change History (4)

comment:1 by warmerdam, 11 years ago

Is your nodata marked using the NODATA_VALUES dataset level metadata or as band-by-band nodata values?

It would be nice for rgb2pct.py to handle nodata rgb tuples marked via NODATA_VALUES as you suggest as well as pixels which are nodata according to each of the per-band nodata values. What is less clear is what to do when, for instance, the red is the per-band nodata value, but the green and blue aren't.

in reply to:  1 ; comment:2 by dal, 11 years ago

band-by-band nodata values like this:

Band 1 Block=168x16 Type=Byte, ColorInterp=Red

NoData Value=255

Band 2 Block=168x16 Type=Byte, ColorInterp=Green

NoData Value=255

Band 3 Block=168x16 Type=Byte, ColorInterp=Blue

NoData Value=255

Replying to warmerdam:

Is your nodata marked using the NODATA_VALUES dataset level metadata or as band-by-band nodata values?

It would be nice for rgb2pct.py to handle nodata rgb tuples marked via NODATA_VALUES as you suggest as well as pixels which are nodata according to each of the per-band nodata values. What is less clear is what to do when, for instance, the red is the per-band nodata value, but the green and blue aren't.

in reply to:  2 comment:3 by alobo, 7 years ago

According to the definition of No Data, a pixel is NODATA as soon as any band is NODATA. In my case, I actually set as NODATA all bands of a multi-spectral image if >=1 bands are NODATA. If a user wants ta given tuple i.e. (NODATA, 100,230) be treated as DATA, he/she should change his/her image value to i.e. (0, 100, 230) , if that makes sense at all. Please do implement this enhancement. It is very important to display color composites in Google Maps.

Replying to dal:

band-by-band nodata values like this:

Band 1 Block=168x16 Type=Byte, ColorInterp=Red

NoData Value=255

Band 2 Block=168x16 Type=Byte, ColorInterp=Green

NoData Value=255

Band 3 Block=168x16 Type=Byte, ColorInterp=Blue

NoData Value=255

Replying to warmerdam:

Is your nodata marked using the NODATA_VALUES dataset level metadata or as band-by-band nodata values?

It would be nice for rgb2pct.py to handle nodata rgb tuples marked via NODATA_VALUES as you suggest as well as pixels which are nodata according to each of the per-band nodata values. What is less clear is what to do when, for instance, the red is the per-band nodata value, but the green and blue aren't.

comment:4 by Even Rouault, 5 years ago

Milestone: closed_because_of_github_migration
Resolution: wontfix
Status: newclosed

This ticket has been automatically closed because Trac is no longer used for GDAL bug tracking, since the project has migrated to GitHub. If you believe this ticket is still valid, you may file it to https://github.com/OSGeo/gdal/issues if it is not already reported there.

Note: See TracTickets for help on using tickets.