GeoServer
  1. GeoServer
  2. GEOS-199

Support gif as an output format for the WMS

    Details

    • Type: New Feature New Feature
    • Status: Closed Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.3.0
    • Component/s: WMS
    • Labels:
      None
    • Number of attachments :
      5

      Description

      Patrick Schlaepfer has been experimenting with gif production from GeoServer, as it has good support for transparency. This task is a reminder to include his work in the next release of GeoServer.

      Patrick, you can attach files directly to the task, and then we can roll them into the code base.

      1. GetMapResponse.java
        7 kB
        Patrick Schlaepfer
      2. GIFOutputStream.java
        25 kB
        Patrick Schlaepfer
      3. JAIMapResponse.java
        14 kB
        Patrick Schlaepfer
      1. screenshot-1.jpg
        56 kB

        Issue Links

          Activity

          Hide
          Gabriel Roldan added a comment -

          Actually it is in place, but needs a slight fix.
          It has it's own MapProducer and factory implementation, which is registered in
          META-INF/services.
          And yes, gif support in JAI is broken and we had the factory precedence problem (aka. which factory is found first for producing a
          given map format). As a workaround, we declare the GIFMapProducerFactory before the JAI one, in the services meta file, so it is found prior to the jai factory.

          Here is a brief resume of the discussion lost in the email list that did not reach this issue:

          • at first, GifOutputStream used a fixed color for transparency. For instance, it was black, which lead to all black lines and fills being transparent.
          • then, the map's BGCOLOR was used as the transparent one, but this lead to having strokes and fills transparent then they are equal to the bgcolor, which, unfortunatelly, defaults to WHITE. So this is not a good approach too.
          • Now, I think there are 2 possible solutions:
          • the first one is to use a less common fixed color for transparency, say, magenta. I guess this is a common approach since I saw a lot of gif images having magenta as transparent color in the windows land.
          • the other would be to programatically create a color that is not in the image's pallete.

          Patrick: may be you could take care of this? if you do not have time please tell me so I may be have a run.

          Show
          Gabriel Roldan added a comment - Actually it is in place, but needs a slight fix. It has it's own MapProducer and factory implementation, which is registered in META-INF/services. And yes, gif support in JAI is broken and we had the factory precedence problem (aka. which factory is found first for producing a given map format). As a workaround, we declare the GIFMapProducerFactory before the JAI one, in the services meta file, so it is found prior to the jai factory. Here is a brief resume of the discussion lost in the email list that did not reach this issue: at first, GifOutputStream used a fixed color for transparency. For instance, it was black, which lead to all black lines and fills being transparent. then, the map's BGCOLOR was used as the transparent one, but this lead to having strokes and fills transparent then they are equal to the bgcolor, which, unfortunatelly, defaults to WHITE. So this is not a good approach too. Now, I think there are 2 possible solutions: the first one is to use a less common fixed color for transparency, say, magenta. I guess this is a common approach since I saw a lot of gif images having magenta as transparent color in the windows land. the other would be to programatically create a color that is not in the image's pallete. Patrick: may be you could take care of this? if you do not have time please tell me so I may be have a run.
          Hide
          dblasby added a comment -

          I've moved this to a later release since it will not be done by tomorrow.

          Show
          dblasby added a comment - I've moved this to a later release since it will not be done by tomorrow.
          Hide
          Chris Holmes added a comment -

          So I think a good bit of this work has been rolled in. We now report gif on our capabilities, and things seem to go along when you call it, but instead of an image I get:

          The image "http://localhost:8080/geoserver/wms?bbox=-130,24,-66,50&styles=population&Format=image/gif&request=GetMap&layers=states&width=550&height=250&srs=EPSG:4326" cannot be displayed, because it contains errors.

          Any ideas?

          Show
          Chris Holmes added a comment - So I think a good bit of this work has been rolled in. We now report gif on our capabilities, and things seem to go along when you call it, but instead of an image I get: The image "http://localhost:8080/geoserver/wms?bbox=-130,24,-66,50&styles=population&Format=image/gif&request=GetMap&layers=states&width=550&height=250&srs=EPSG:4326" cannot be displayed, because it contains errors. Any ideas?
          Hide
          dblasby added a comment -

          I've tested the GIF support - it appears the bottom edge of the image is getting cliped (by 5 pixels).

          Show
          dblasby added a comment - I've tested the GIF support - it appears the bottom edge of the image is getting cliped (by 5 pixels).
          Hide
          dblasby added a comment -

          I changed the writer to a new one, added colour reduction algorithm and changed how transparency was done.

          Show
          dblasby added a comment - I changed the writer to a new one, added colour reduction algorithm and changed how transparency was done.

            People

            • Assignee:
              Gabriel Roldan
              Reporter:
              Chris Holmes
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: