[Geoserver-devel] geoserver and 8-bit pngs

Maurice Tamman wrote:

Jody:

I couldn’t find anything on this so I’m taking a shot with you. This is my first time working directly with a mapping server.

We recently started using Geoserver 1.3.2 to serve up shape files to a Google Maps mashup.

Sweet.

For the time being these maps are utterly static so we’re caching the tiles.

Okay, I am mostly familiar with the GIS hacking side of things, have not played with google maps and caching yet.

The tiles load relatively fast in FF using image/png but it looks like they are 24-bit pngs because the transparency gets all buggered up in IE. Rendering as GIFs works in both browsers but is significantly slower.

Obviously, I want the fastest option. Is there a way to have the tiles render as 8 bit pngs so the transparency will work in IE?

GeoServer can generate output in several different formats, I am not sure if 8 bit PNG is supported right now but we can talk to Brent to find out.

Also, is there a way to test if the caching is working as billed?

Good question, I would change the SLD style sheet to render the content in a different color and see what happened.
Jody

For all the image writers, the system should be creating a 32bit
Buffered Image (see DefaultRasterMapProducer) thats passed to the
appropriate image writer.

The JPG writer converts this to a 24bit image (by removing the alpha
channel) because JPGs do not support transparency.

The PNG writer is optimized for 32 and 24 bit writing - it currently
has no support for 8bit writing.

The GIF producer is slow because it does 2 extra steps:
1. does a bunch of alpha processing because GIF transparency is very
simple (a single colour in the 256 colour map is considered 100%
transparent). So, there's 8bit alpha -> 1 bit transparency code.
This is more work that you would think beause the GIF file format this
is a more complex that you would think.

2. It also does 24bit->8bit colour reduction. The algorithm is slow.
There's apparently JAI code that also does this -- ask Allessio or
simonne ("WCS" guys) as their WorldImageWriter has a working example.

To get 8 bit PNG:
1. figure out how your going to support transparency
2. get the 24->8bit code from the WCS guys
3. get something that writes PNG 8bit files (PNG file format is super
simple - you should find examples on the net). Make sure you check IP
issues.

dave

Hi, related to add 8bit png support in geoserver, there is an improvement
I'm wanting to propose since a time ago, now that you dear user are requiring
it sounds like a good chance to force me to move my ass :wink:

The thing is that geoserver creates a 32bit ARGB in-memory image regardless of
the intended output format, which in much cases is an unnecesary waste of
resources.
<snip>
BufferedImage curImage = new BufferedImage(width,
height,BufferedImage.TYPE_4BYTE_ABGR);
</snip>

I know we could allow to specify is either a 32 bit or an 8 bit png has to be
outputed through parameters in the requested mime type, so I would like to
try using a BufferedImage of TYPE_BYTE_INDEXED and proper IndexColorModel.

So, anyone has tried it already? since we already changed from TYPE_INT_ARGB
to TYPE_4BYTE_ABGR, I would like to know if someone did experimented with it.

On the other side, do we should set up some kind of configurable limit for the
dimensions of the requested images? say someone asks for a 100K x 100K jpeg
and kills your server when it tries to create such a BufferedImage...

regards,

Gabriel

On Thursday 13 July 2006 15:21, Jody Garnett wrote:

Maurice Tamman wrote:
> Jody:
>
> I couldn’t find anything on this so I’m taking a shot with you. This
> is my first time working directly with a mapping server.
>
> We recently started using Geoserver 1.3.2 to serve up shape files to a
> Google Maps mashup.

Sweet.

> For the time being these maps are utterly static so we’re caching the
> tiles.

Okay, I am mostly familiar with the GIS hacking side of things, have not
played with google maps and caching yet.

> The tiles load relatively fast in FF using image/png but it looks like
> they are 24-bit pngs because the transparency gets all buggered up in
> IE. Rendering as GIFs works in both browsers but is significantly slower.
>
> Obviously, I want the fastest option. Is there a way to have the tiles
> render as 8 bit pngs so the transparency will work in IE?

GeoServer can generate output in several different formats, I am not
sure if 8 bit PNG is supported right now but we can talk to Brent to
find out.

> Also, is there a way to test if the caching is working as billed?

Good question, I would change the SLD style sheet to render the content
in a different color and see what happened.
Jody

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job
easier Download IBM WebSphere Application Server v.1.0.1 based on Apache
Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

--
Gabriel Roldán (groldan@anonymised.com)
Axios Engineering (http://www.axios.es)
Tel. +34 944 41 63 84
Fax. +34 944 41 64 90

I think you need to supply the colour map for an 8bit index image (but
I could be wrong). Thats not something you can create a-priori.

dave

On 7/13/06, Gabriel Roldán <groldan@anonymised.com> wrote:

Hi, related to add 8bit png support in geoserver, there is an improvement
I'm wanting to propose since a time ago, now that you dear user are requiring
it sounds like a good chance to force me to move my ass :wink:

The thing is that geoserver creates a 32bit ARGB in-memory image regardless of
the intended output format, which in much cases is an unnecesary waste of
resources.
<snip>
BufferedImage curImage = new BufferedImage(width,
height,BufferedImage.TYPE_4BYTE_ABGR);
</snip>

I know we could allow to specify is either a 32 bit or an 8 bit png has to be
outputed through parameters in the requested mime type, so I would like to
try using a BufferedImage of TYPE_BYTE_INDEXED and proper IndexColorModel.

So, anyone has tried it already? since we already changed from TYPE_INT_ARGB
to TYPE_4BYTE_ABGR, I would like to know if someone did experimented with it.

On the other side, do we should set up some kind of configurable limit for the
dimensions of the requested images? say someone asks for a 100K x 100K jpeg
and kills your server when it tries to create such a BufferedImage...

regards,

Gabriel

On Thursday 13 July 2006 15:21, Jody Garnett wrote:
> Maurice Tamman wrote:
> > Jody:
> >
> > I couldn't find anything on this so I'm taking a shot with you. This
> > is my first time working directly with a mapping server.
> >
> > We recently started using Geoserver 1.3.2 to serve up shape files to a
> > Google Maps mashup.
>
> Sweet.
>
> > For the time being these maps are utterly static so we're caching the
> > tiles.
>
> Okay, I am mostly familiar with the GIS hacking side of things, have not
> played with google maps and caching yet.
>
> > The tiles load relatively fast in FF using image/png but it looks like
> > they are 24-bit pngs because the transparency gets all buggered up in
> > IE. Rendering as GIFs works in both browsers but is significantly slower.
> >
> > Obviously, I want the fastest option. Is there a way to have the tiles
> > render as 8 bit pngs so the transparency will work in IE?
>
> GeoServer can generate output in several different formats, I am not
> sure if 8 bit PNG is supported right now but we can talk to Brent to
> find out.
>
> > Also, is there a way to test if the caching is working as billed?
>
> Good question, I would change the SLD style sheet to render the content
> in a different color and see what happened.
> Jody
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job
> easier Download IBM WebSphere Application Server v.1.0.1 based on Apache
> Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Geoserver-devel mailing list
> Geoserver-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geoserver-devel

--
Gabriel Roldán (groldan@anonymised.com)
Axios Engineering (http://www.axios.es)
Tel. +34 944 41 63 84
Fax. +34 944 41 64 90

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

hmm, it has to be a way, I guess I would investigate a bit.

I got this example from a java.net forum, which claims to write 8-bit png
images with proper transparency:

BufferedImage b = graphic.getDeviceConfiguration().createCompatibleImage(w, h,
Transparency.BITMASK);
Graphics2D gout = out.createGraphics();
gout.setComposite(AlphaComposite.Src);
gout.drawImage(in, 0, 0, targetWidth, targetHeight, null);
gout.dispose();
ImageIO.write(out, "png", destFile);

On Thursday 13 July 2006 17:08, David Blasby wrote:

I think you need to supply the colour map for an 8bit index image (but
I could be wrong). Thats not something you can create a-priori.

dave

On 7/13/06, Gabriel Roldán <groldan@anonymised.com> wrote:
> Hi, related to add 8bit png support in geoserver, there is an improvement
> I'm wanting to propose since a time ago, now that you dear user are
> requiring it sounds like a good chance to force me to move my ass :wink:
>
> The thing is that geoserver creates a 32bit ARGB in-memory image
> regardless of the intended output format, which in much cases is an
> unnecesary waste of resources.
> <snip>
> BufferedImage curImage = new BufferedImage(width,
> height,BufferedImage.TYPE_4BYTE_ABGR);
> </snip>
>
> I know we could allow to specify is either a 32 bit or an 8 bit png has
> to be outputed through parameters in the requested mime type, so I would
> like to try using a BufferedImage of TYPE_BYTE_INDEXED and proper
> IndexColorModel.
>
> So, anyone has tried it already? since we already changed from
> TYPE_INT_ARGB to TYPE_4BYTE_ABGR, I would like to know if someone did
> experimented with it.
>
> On the other side, do we should set up some kind of configurable limit
> for the dimensions of the requested images? say someone asks for a 100K x
> 100K jpeg and kills your server when it tries to create such a
> BufferedImage...
>
> regards,
>
> Gabriel
>
> On Thursday 13 July 2006 15:21, Jody Garnett wrote:
> > Maurice Tamman wrote:
> > > Jody:
> > >
> > > I couldn't find anything on this so I'm taking a shot with you. This
> > > is my first time working directly with a mapping server.
> > >
> > > We recently started using Geoserver 1.3.2 to serve up shape files to
> > > a Google Maps mashup.
> >
> > Sweet.
> >
> > > For the time being these maps are utterly static so we're caching the
> > > tiles.
> >
> > Okay, I am mostly familiar with the GIS hacking side of things, have
> > not played with google maps and caching yet.
> >
> > > The tiles load relatively fast in FF using image/png but it looks
> > > like they are 24-bit pngs because the transparency gets all buggered
> > > up in IE. Rendering as GIFs works in both browsers but is
> > > significantly slower.
> > >
> > > Obviously, I want the fastest option. Is there a way to have the
> > > tiles render as 8 bit pngs so the transparency will work in IE?
> >
> > GeoServer can generate output in several different formats, I am not
> > sure if 8 bit PNG is supported right now but we can talk to Brent to
> > find out.
> >
> > > Also, is there a way to test if the caching is working as billed?
> >
> > Good question, I would change the SLD style sheet to render the content
> > in a different color and see what happened.
> > Jody
> >
> >
> >
> >
> > -----------------------------------------------------------------------
> >-- Using Tomcat but need to do more? Need to support web services,
> > security? Get stuff done quickly with pre-integrated technology to make
> > your job easier Download IBM WebSphere Application Server v.1.0.1 based
> > on Apache Geronimo
> > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=12164
> >2 _______________________________________________
> > Geoserver-devel mailing list
> > Geoserver-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/geoserver-devel
>
> --
> Gabriel Roldán (groldan@anonymised.com)
> Axios Engineering (http://www.axios.es)
> Tel. +34 944 41 63 84
> Fax. +34 944 41 64 90
>
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job
> easier Download IBM WebSphere Application Server v.1.0.1 based on Apache
> Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Geoserver-devel mailing list
> Geoserver-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geoserver-devel

--
Gabriel Roldán (groldan@anonymised.com)
Axios Engineering (http://www.axios.es)
Tel. +34 944 41 63 84
Fax. +34 944 41 64 90

Could someone file a bug/feature request for this on JIRA? If 8-bit png is faster than jpeg and does do transparency on all browsers and looks as good, it sounds like it'd be a great win. If anyone finds the solution please attach to the jira issue and I'll roll it in quickly, or just commit yourself if you've got commit rights.

best regards,

Chris

Gabriel Roldán wrote:

hmm, it has to be a way, I guess I would investigate a bit.

I got this example from a java.net forum, which claims to write 8-bit png images with proper transparency:

BufferedImage b = graphic.getDeviceConfiguration().createCompatibleImage(w, h, Transparency.BITMASK);
Graphics2D gout = out.createGraphics();
gout.setComposite(AlphaComposite.Src);
gout.drawImage(in, 0, 0, targetWidth, targetHeight, null);
gout.dispose();
ImageIO.write(out, "png", destFile);

On Thursday 13 July 2006 17:08, David Blasby wrote:

I think you need to supply the colour map for an 8bit index image (but
I could be wrong). Thats not something you can create a-priori.

dave

On 7/13/06, Gabriel Roldán <groldan@anonymised.com> wrote:

Hi, related to add 8bit png support in geoserver, there is an improvement
I'm wanting to propose since a time ago, now that you dear user are
requiring it sounds like a good chance to force me to move my ass :wink:

The thing is that geoserver creates a 32bit ARGB in-memory image
regardless of the intended output format, which in much cases is an
unnecesary waste of resources.
<snip>
BufferedImage curImage = new BufferedImage(width,
height,BufferedImage.TYPE_4BYTE_ABGR);
</snip>

I know we could allow to specify is either a 32 bit or an 8 bit png has
to be outputed through parameters in the requested mime type, so I would
like to try using a BufferedImage of TYPE_BYTE_INDEXED and proper
IndexColorModel.

So, anyone has tried it already? since we already changed from
TYPE_INT_ARGB to TYPE_4BYTE_ABGR, I would like to know if someone did
experimented with it.

On the other side, do we should set up some kind of configurable limit
for the dimensions of the requested images? say someone asks for a 100K x
100K jpeg and kills your server when it tries to create such a
BufferedImage...

regards,

Gabriel

On Thursday 13 July 2006 15:21, Jody Garnett wrote:

Maurice Tamman wrote:

Jody:

I couldn't find anything on this so I'm taking a shot with you. This
is my first time working directly with a mapping server.

We recently started using Geoserver 1.3.2 to serve up shape files to
a Google Maps mashup.

Sweet.

For the time being these maps are utterly static so we're caching the
tiles.

Okay, I am mostly familiar with the GIS hacking side of things, have
not played with google maps and caching yet.

The tiles load relatively fast in FF using image/png but it looks
like they are 24-bit pngs because the transparency gets all buggered
up in IE. Rendering as GIFs works in both browsers but is
significantly slower.

Obviously, I want the fastest option. Is there a way to have the
tiles render as 8 bit pngs so the transparency will work in IE?

GeoServer can generate output in several different formats, I am not
sure if 8 bit PNG is supported right now but we can talk to Brent to
find out.

Also, is there a way to test if the caching is working as billed?

Good question, I would change the SLD style sheet to render the content
in a different color and see what happened.
Jody

-----------------------------------------------------------------------
-- Using Tomcat but need to do more? Need to support web services,
security? Get stuff done quickly with pre-integrated technology to make
your job easier Download IBM WebSphere Application Server v.1.0.1 based
on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=12164
2 _______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

--
Gabriel Roldán (groldan@anonymised.com)
Axios Engineering (http://www.axios.es)
Tel. +34 944 41 63 84
Fax. +34 944 41 64 90

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job
easier Download IBM WebSphere Application Server v.1.0.1 based on Apache
Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

--
Chris Holmes
The Open Planning Project
http://topp.openplans.org