mapstatic
mapstatic copied to clipboard
generated png have unnecessary offset/boxing (and is it correct at all?)
The png images generated with mapstatic have "offset" information. I'm not sure whether the offset information is wrong or not, but it certainly unnecessary and it produces avoidable problems when converting it to other formats such as gif.
For example, http://matteosistisette.com/example_map.png the image was generated with this command: mapstatic map example_map.png --zoom=17 --lat=41.8879600 --lng=12.4661800 --width=900 --height=360 --provider=http://a.tile.stamen.com/toner/{z}/{x}/{y}.png
The output: { :bbox => "12.461352023773202,41.88652230545747,12.471007976226815,41.88939766218839", :width => 900, :height => 360, :zoom => 17, :number_of_tiles => 8 }
When converting this to gif with imagemagik convert example_map.png example_map.gif
the result is this: http://matteosistisette.com/example_map.gif
which is bigger with a transparent frame.
The png is shown as expected in a browser, and I don't know whether this is because the offset information is correct or because the browser ignores it. In any case, it is COMPLETELY UNNECESSARY AND UNDESIRABLE to generate a bigger image with transparent margins and offset information, whatever it is.
If I open it in GIMP, I get a warning that the image contains offset information, whether to ignore it or apply offset to a layer. Surprisingly, it only opens correctly if I choose to ignore the offset, while if I choose to apply the offet, it gets screwed up. Not sure whether it's GIMP not applying the offset correctly (or maybe the prompt not phrased correctly).
But why creating this offset at all in the first place??
As a workaround, the boxing can be removed with imagemagick's +repage