#4905 closed defect (fixed)
pct2rgb fails when palette/RAT has >256 entries
Reported by: | Robert Coup | Owned by: | Robert Coup |
---|---|---|---|
Priority: | normal | Milestone: | 1.10.0 |
Component: | Utilities | Version: | svn-trunk |
Severity: | normal | Keywords: | pct2rgb |
Cc: |
Description
When running pct2rgb
against an image having a colour table with >256 entries, it dies. The lookup array built from the colour table is built as max(256, len(colourTable))
rather than min(256, len(colourTable))
, so lookups for entries after 256 fail:
$ pct2rgb -rgba rat.img test_pct2rgb_4.tif File "pct2rgb.py", line 167, in <module> dst_data = Numeric.take(band_lookup,src_data) File "/usr/lib/python2.7/dist-packages/numpy/core/fromnumeric.py", line 103, in take return take(indices, axis, out, mode) IndexError: index out of range for array
I've attached a patch, test case, and am sourcing licensing release for the image used in the test case.
Attachments (1)
Change History (3)
by , 11 years ago
comment:1 by , 11 years ago
Milestone: | → 1.10.0 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
I've applied the patch to pct2rgb.py in r25674 (but not the new test case since the source image is missing)
comment:2 by , 11 years ago
Added the test case in r25688.
The test data (trunk/autotest/gcore/data/rat.img) is from Land Environments New Zealand (LENZ) Level 2 - CC-BY Licensed by Ministry for the Environment. ERDAS Imagine conversion & processing by Landcare Research. Release for GDAL's test suite explicitly cleared.
Patch & test case