geosolutions-it / jai-ext

Java Advanced Imaging Open Source Replacement Wannabe
Apache License 2.0
90 stars 37 forks source link

Warp bilinear and bicubic will fail against indexed color sources with 4 components #180

Closed aaime closed 6 years ago

aaime commented 6 years ago

The current code interpolates colors by expanding the color map, however only accounts for RGB images with transparent pixel, won't consider the case where the palette has 4 components (alpha included) and as a result will fail with a:

INFORMAZIONI: Problem occurs when computing a tile by the owner. 
java.lang.ArrayIndexOutOfBoundsException: 3 at 
it.geosolutions.jaiext.warp.WarpBilinearOpImage.computeRectByte(WarpBilinearOpImage.java:393) at 
it.geosolutions.jaiext.warp.WarpOpImage.computeRect(WarpOpImage.java:285

This happens because the output image is 4 banded and the ctable main array only has 3 entries.