Developer’s Corner: Smart transparency in GeoServer with image/vnd.jpeg-png format

GeoServer

Dear reader,

today we would like to introduce a new feature in GeoServer: smart transparency with image/vnd.jpeg-png format.

When dealing with satellite and aerial imagery the JPEG output format is often preferred for its fast encoding and small output size. However, there are cases in which transparency is needed, maybe because the imagery is not covering the whole map area, or maybe because the user is free to select only certain image strips, and seeing though the basemap is a requirement.

Thus far those scenarios were handled by falling back on the PNG format, paying the extra encoding time and size. To address this shortcoming, the GeoServer developer series recently saw the addition of a new output format, named “image/vnd.jpeg-png”. As the name implies, it’s a vendor format that will generate either JPEG or PNG images in output, depending on the image contents: if the pixels are fully opaque, JPEG will be used, if any is transparent or translucent (non fully opaque) then PNG will be generated instead.

Of course, the content type of the returned image will be set accordingly, so browsers will transparently use the new format without requiring any change. Here is a peek at the developer tools running of a layer preview where the JPEG-PNG format was chosen (mind, the preview request needs to be modified, adding “&transparent=true” to its URL, otherwise only opaque images are generated):

Selezione_001

 

As you can see, the type of the tile is either JPEG or PNG depending on whether the tile is full of raster data, or has transparent pixels.

This feature has just landed in the developer series of GeoServer, you can try it out using the nightly builds at http://ares.boundlessgeo.com/geoserver/master/

It is worth to point out that this work has been performed under the umbrella of our GeoSolutions Enterprise Support Services offer.

If you want to know more about how we can help your organization, don’t hesitate and get in touch with us! Make sure to check our Enterprise Services Offer which has been used to complete the work described in this post.

The GeoSolutions Team,

Geosolutions

 

1 comment

 
  1. Pingback: GeoServer 2.10.0 released ()

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>