Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gdal_translate -expand rgba produces wrong colors (but pct2rgb.py -rgba produces correct colors #9402

Closed
hemantbist opened this issue Mar 6, 2024 · 2 comments · Fixed by #9403

Comments

@hemantbist
Copy link

hemantbist commented Mar 6, 2024

What is the bug?

gdal_translate -expand rgba  a.tif /tmp/gdal.tif  # This produces a tif file with incorrect colors.pct2rgb.py -rgba a.tif  gdal_good.tif # This produces the tif file with correct colors.

I have tried it on 3.4.3 and on some earlier version. The  behavior is same.

a.tif.gz

Steps to reproduce the issue

The a.tif is attached with bug.
gdal_translate -expand rgba a.tif gdalbad.tif # This produces a tif file with incorrect colors.
pct2rgb.py -rgba a.tif gdalgood.tif # This produces the tif file with correct colors.

view it in a viewer e.g. qgis. The gdalgood.tif produces correct colors. [Mostly Blue with transparency]. This is same as a.tif
gdaltif productrs bad colors.

Versions and provenance

ubuntu 20.04
gdal_translate --version
GDAL 3.4.3, released 2022/04/22

Additional context

No response

rouault added a commit to rouault/gdal that referenced this issue Mar 6, 2024
…type if not specified and color table compatible of it (fixes OSGeo#9402)
rouault added a commit to rouault/gdal that referenced this issue Mar 6, 2024
…type if not specified and color table compatible of it (fixes OSGeo#9402)
@rouault
Copy link
Member

rouault commented Mar 6, 2024

fix in #9403. Easy workaround: add -ot Byte

@hemantbist
Copy link
Author

Thanks, The workaround works! Will mark it as closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants