[Geoserver-devel] Inversion of Color Map addition on 1.5.x

Hi lists,
I am about to commit to the 1.5.x branch some changes I made over the last
few days in order to boost support for fixed palettes aka inversion of
colour map.
For whom is interested this allows to specify a palette to use when
performing the colour quantization mechanism which result in faster
quantization since we do not have to create a (near)optimal palette on the
fly.

This code will replace the code we were using previously, if it proves to be
robust enough of course. The difference relies in the fact that now we can
draw in true colour with antialiasing on and doing the inversion of colour
later on. As of now this was impossible since we were using the palette
directly for rendering but due to some j2d bugs we had to turn off
antiliasing.

There are another small improvements that I added. Once for all is the
ability to parse JASC Pal files in order to give people more control over
creating palettes.

Tomorrow I will write some more about to configure the palette and I promise
to add more javadocs to the relevant classes. For today I have done enough,
I have to go pay taxes and this really bothers me :frowning:

Ciao,
Simone.
-------------------------------------------------------
Eng. Simone Giannecchini
President /CEO GeoSolutions S.A.S.
Via Carignoni 51
55041 Camaiore (LU)
Italy

phone: +39 0584983027
fax: +39 0584983027
mob: +39 333 8128928

http://www.geo-solutions.it

-------------------------------------------------------

Hi Simone,

Sounds great!!! As usual your work is impressive.. However i have the same concern that i have when development occurs on any stable branch. Is there a plan to migrate/port this work to trunk?

-Justin

Simone Giannecchini wrote:

Hi lists,
I am about to commit to the 1.5.x branch some changes I made over the last
few days in order to boost support for fixed palettes aka inversion of
colour map.
For whom is interested this allows to specify a palette to use when
performing the colour quantization mechanism which result in faster
quantization since we do not have to create a (near)optimal palette on the
fly.

This code will replace the code we were using previously, if it proves to be
robust enough of course. The difference relies in the fact that now we can
draw in true colour with antialiasing on and doing the inversion of colour
later on. As of now this was impossible since we were using the palette
directly for rendering but due to some j2d bugs we had to turn off
antiliasing.

There are another small improvements that I added. Once for all is the
ability to parse JASC Pal files in order to give people more control over
creating palettes.

Tomorrow I will write some more about to configure the palette and I promise
to add more javadocs to the relevant classes. For today I have done enough,
I have to go pay taxes and this really bothers me :frowning:

Ciao,
Simone.
-------------------------------------------------------
Eng. Simone Giannecchini
President /CEO GeoSolutions S.A.S.
Via Carignoni 51 55041 Camaiore (LU) Italy

phone: +39 0584983027
fax: +39 0584983027
mob: +39 333 8128928

http://www.geo-solutions.it

-------------------------------------------------------

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

!DSPAM:4007,4695019e308927082231907!

--
Justin Deoliveira
The Open Planning Project
http://topp.openplans.org

Ciao Justin,
If things work great on the 1.5 branch and if nobody will be able to port
them to trunk next week we'll find one day or two to do the port. However I
cannot really give a strict deadline. The most we can usually do on our
part is to donate everything we develop to the 1.5 branch in the most
painless possible way which means with as less grieves as possible for the
other developers.
We are bound to work with a semi-stable geoserver-geotools stack hence doing
this things on trunk is too risky for us for the moment.

Ciao,
Simone.
-------------------------------------------------------
Eng. Simone Giannecchini
President /CEO GeoSolutions S.A.S.
Via Carignoni 51
55041 Camaiore (LU)
Italy

phone: +39 0584983027
fax: +39 0584983027
mob: +39 333 8128928

http://www.geo-solutions.it

-------------------------------------------------------

-----Original Message-----
From: geoserver-devel-bounces@lists.sourceforge.net
[mailto:geoserver-devel-bounces@lists.sourceforge.net] On Behalf Of Justin
Deoliveira
Sent: mercoledì 11 luglio 2007 19.36
To: simone.giannecchini@anonymised.com
Cc: geoserver-devel@lists.sourceforge.net; geoserver-user@anonymised.com
Subject: Re: [Geoserver-devel] Inversion of Color Map addition on 1.5.x

Hi Simone,

Sounds great!!! As usual your work is impressive.. However i have the
same concern that i have when development occurs on any stable branch.
Is there a plan to migrate/port this work to trunk?

-Justin

Simone Giannecchini wrote:

Hi lists,
I am about to commit to the 1.5.x branch some changes I made over the last
few days in order to boost support for fixed palettes aka inversion of
colour map.
For whom is interested this allows to specify a palette to use when
performing the colour quantization mechanism which result in faster
quantization since we do not have to create a (near)optimal palette on the
fly.

This code will replace the code we were using previously, if it proves to

be

robust enough of course. The difference relies in the fact that now we can
draw in true colour with antialiasing on and doing the inversion of colour
later on. As of now this was impossible since we were using the palette
directly for rendering but due to some j2d bugs we had to turn off
antiliasing.

There are another small improvements that I added. Once for all is the
ability to parse JASC Pal files in order to give people more control over
creating palettes.

Tomorrow I will write some more about to configure the palette and I

promise

to add more javadocs to the relevant classes. For today I have done

enough,

I have to go pay taxes and this really bothers me :frowning:

Ciao,
Simone.
-------------------------------------------------------
Eng. Simone Giannecchini
President /CEO GeoSolutions S.A.S.
Via Carignoni 51
55041 Camaiore (LU)
Italy

phone: +39 0584983027
fax: +39 0584983027
mob: +39 333 8128928

http://www.geo-solutions.it

-------------------------------------------------------

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

!DSPAM:4007,4695019e308927082231907!

--
Justin Deoliveira
The Open Planning Project
http://topp.openplans.org

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Simone Giannecchini ha scritto:

Hi lists, I am about to commit to the 1.5.x branch some changes I
made over the last few days in order to boost support for fixed
palettes aka inversion of colour map. For whom is interested this
allows to specify a palette to use when performing the colour
quantization mechanism which result in faster quantization since we
do not have to create a (near)optimal palette on the fly.

Hi Simone,
just tried it out, sorry for the delay. Now, with the untiled map
preview, it works very well... I tried states, the new sample
map group tiger-ny and with the new spearfish dataset all against
the safe palette, which is not optimized in any way, yet the result
was quite good looking and quick to get on the screen
(well, the spearfish demo has a DEM in
the background, that one jumped from one color to another, but
that's to be expected, one should either not use paletted images
for raster data, or create a carefully crafted palette).

Images are a lot smaller, as expected. For example:
http://localhost:8080/geoserver/wms?HEIGHT=317&WIDTH=800
&LAYERS=topp%3Astates&STYLES=&SRS=EPSG%3A4326&FORMAT=image%2Fpng
&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap
&EXCEPTIONS=application%2Fvnd.ogc.se_inimage
&BBOX=-122.655615%2C30.121339%2C-73.016764%2C49.790734
-> 800x316 pixels, 58.73kb

http://localhost:8080/geoserver/wms?HEIGHT=317&WIDTH=800
&LAYERS=topp%3Astates&STYLES=&SRS=EPSG%3A4326&FORMAT=image%2Fpng
&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap
&EXCEPTIONS=application%2Fvnd.ogc.se_inimage
&BBOX=-122.655615%2C30.121339%2C-73.016764%2C49.790734&PALETTE=safe
-> 800x317 pixels, 17.95kb

Now, that's a neat gain. (in this particular image the paletted
version colors are visibly lighter, but that's simply because the
actual color used in the SLD have no match in the internet
safe palette).

Which makes me think... you added support for the Paint Shop
Pro palette format. Have you seen any palette collection around the
net that we could add to Geoserver? I'm sure I've seen some, maybe
for other programs, but cannot find them anymore. I think it would
be a nice addition, especially if we could visualize them in a
sort of preview page.

And now the sad notes: the standard tiled preview is broken.
The error follows:

...
Caused by: java.lang.ClassCastException: javax.media.jai.RenderedOp
cannot be cast to java.awt.image.BufferedImage
  at
org.vfny.geoserver.wms.responses.DefaultRasterMapProducer.forceIndexed8Bitmask(DefaultRasterMapProducer.java:334)
  at
org.vfny.geoserver.wms.responses.map.png.PNGMapProducer.formatImageOutputStream(PNGMapProducer.java:66)
  at
org.vfny.geoserver.wms.responses.map.metatile.MetatileMapProducer.writeTo(MetatileMapProducer.java:215)
  at
org.vfny.geoserver.wms.responses.GetMapResponse.writeTo(GetMapResponse.java:496)
  at
org.vfny.geoserver.servlets.AbstractService.doService(AbstractService.java:592)
  ... 27 more

I looked a bit in the code, it would be possible to perform
palette inversion anyways but apparently the code would have to
be tile oriented, since RenderedImage provides you a copy-less
access to its Raster only if you access it tile by tile.

Thoughts?
Cheers
Andrea

Andrea Aime ha scritto:

Which makes me think... you added support for the Paint Shop
Pro palette format. Have you seen any palette collection around the
net that we could add to Geoserver? I'm sure I've seen some, maybe
for other programs, but cannot find them anymore. I think it would
be a nice addition, especially if we could visualize them in a
sort of preview page.

Hmm... here is a collection of palettes, all in GIMP format:
http://www.iosart.com/firefox/colorzilla/palettes.html

Cheers
Andrea