Re: [Geotools-devel] bandOffsets.length is wrong!

2021-02-24 Thread Lorenzo Di Giacomo
I found the problem... One of my co-workers, to read the original TIFF file, used the same read method you used, but after that here used the GridCoverageFactory to generate a copy in the first read, im not sure why. This worked on all TIFF without the Alpha band but with Alpha it generates the err

Re: [Geotools-devel] bandOffsets.length is wrong!

2021-02-24 Thread Daniele Romagnoli
Hi Lorenzo, how do you get that grid object at the top of your code? This is the full example I'm using and it didn't raise any issue. It's basically your code plus a reading part at the beginning and a writing part at the end to check the result. public static void main(String[] args) throws IOE

Re: [Geotools-devel] bandOffsets.length is wrong!

2021-02-24 Thread Lorenzo Di Giacomo
Hi Daniele, im currently using 23.1 but i also tried with 23.4 and i get the same result, seems like the alpha band can't be handled because i tried to remove it with GDAL and everything works fine. Il giorno mer 24 feb 2021 alle ore 09:43 Daniele Romagnoli < daniele.romagn...@geo-solutions.it> ha

Re: [Geotools-devel] bandOffsets.length is wrong!

2021-02-24 Thread Daniele Romagnoli
Hi Lorenzo, which GeoTools version are you using? I have just quickly tried with GeoTools master your very same code also adding a final piece of code doing a rewrite on disk: writer = new GeoTiffWriter(new File("d:/download/writeback.tif"), null); writer.write(grid, null); writer.dispose(); and

[Geotools-devel] bandOffsets.length is wrong!

2021-02-22 Thread Lorenzo Di Giacomo
Hi, i have a problem that i dont understand if GEOTOOLS handles (maybe with some HINTS), basically i read a TIFF image then i serialized it : *public static byte[] gridToBytes(GridCoverage2D grid) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); GeoTiffWriter