Creating GridCoverage2D from BufferedImage.TYPE_USHORT_555_RGB throws Exception

Description

From post by Markus on the user list:

BufferedImage image = ImageIO.read(filename);
GridCoverage2D grid = factory.create("results", image, new ReferencedEnvelope(y1, y2, x1, x2, crs));

->

Exception in thread "BackgroundImageRenderer-0" java.lang.IllegalArgumentException: Illegal argument: "type=null".
at org.geotools.coverage.TypeMap.map(TypeMap.java:407)
at org.geotools.coverage.TypeMap.isFloatingPoint(TypeMap.java:362)
at org.geotools.coverage.grid.RenderedSampleDimension.create(RenderedSampleDimension.java:252)
at org.geotools.coverage.grid.RenderedSampleDimension.create(RenderedSampleDimension.java:138)
at org.geotools.coverage.grid.GridCoverage2D.<init>(GridCoverage2D.java:233)
at org.geotools.coverage.grid.GridCoverageFactory.create(GridCoverageFactory.java:590)
at org.geotools.coverage.grid.GridCoverageFactory.create(GridCoverageFactory.java:514)
at org.geotools.coverage.grid.GridCoverageFactory.create(GridCoverageFactory.java:455)

BufferedImage.TYPE_BYTE_INDEXED and BufferedImage.TYPE_INT_RGB work fine, but the native format of the picture is TYPE_USHORT_555. Conversion takes time and BYTE_INDEXED loses quality and TYPE_INT_RGB takes too much memory.

From the code of TypeMap it seems that it should support 16 bit images.

Environment

None

Activity

Show:
codehaus
April 10, 2015, 3:21 PM

CodeHaus Comment From: mbedward - Time: Sat, 9 Apr 2011 00:53:46 -0500
---------------------
Yuk - just tried adding a new TypeMap instance for the 5 bit case but of course, being the coverage module, nothing is that simple... everything is coupled to everything else and all tested against standard code lists etc. Really it just needs a thorough clean up.

codehaus
April 10, 2015, 3:21 PM

CodeHaus Comment From: mbedward - Time: Sun, 17 Apr 2011 20:06:52 -0500
---------------------
Sorry - I can't work this one out so passing it on.

codehaus
April 10, 2015, 3:21 PM

CodeHaus Comment From: makusu - Time: Tue, 19 Apr 2011 02:29:27 -0500
---------------------
Well, thanks for trying.

codehaus
April 10, 2015, 3:21 PM

CodeHaus Comment From: simboss - Time: Tue, 19 Apr 2011 08:42:16 -0500
---------------------
Tentative fix is in. With next build you should be good to go.

codehaus
April 10, 2015, 3:21 PM

CodeHaus Comment From: aaime - Time: Sat, 28 May 2011 04:19:51 -0500
---------------------
Mass closing all issues that have been in "resolved" state for more than one month without further comments

Fixed

Assignee

Unassigned

Reporter

codehaus

Triage

None

Components

Fix versions

Affects versions

Priority

Low
Configure