vega / vl-convert

Utilities for converting Vega-Lite specs from the command line and Python
BSD 3-Clause "New" or "Revised" License
84 stars 9 forks source link

Support loading images from urls without extensions #163

Closed jonmmease closed 2 months ago

jonmmease commented 2 months ago

Closes #162

The issue was that this tile provider serves images in jpg format, but the URLs do not include a file extension (e.g. https://server.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/5/14/17) and usvg uses the file extension to infer the image type. This PR adds logic to infer the image type from the Content-Type header and use that to build a file extension that usvg is happy with.

cc @binste

mattijn commented 2 months ago

Very clever solution! Really cool to read your code🙌