

Ask HN: Serving Vector Images Via Web API? - bsmith

So, sometimes I need many different sizes of the same vector image on a site (i.e. logo). But saving multiple versions for web from Photoshop is a pain in the ass--especially when a year later you need to change the size of the logo and have to go find the PSD again.<p>How about keeping vector images in a folder somewhere on a webserver in EPS format or the like, and then providing an API that would let you specify the size and image format in the URL, like so:<p>example.com/vectors/logo.png?width=100<p>You could set up caching and then everything would be dandy--just change the URL to get a different size. I think this would be great for icons, logos, etc.<p>I found something similar (http://imageresizing.net/) that requires running a .NET server, but I was wondering if there were other tools out there that did something like this? I've seen approaches that scale an existing raster image, but I like the vector solution better, especially if a pixel-fitting algorithm could be applied (see http://dcurt.is/pixel-fitting). I also tend not to like the results from image-resizing algorithms at smaller sizes.
======
itswitch
You can embed SVG into HTML if you wish.

Basically, browsers support SVG.

~~~
bsmith
Yeah, but part of my goal is to only have to change the source for the image
in one place. I suppose I could have a partial template with the SVG in it and
pass in a variable for the scale, but I would still prefer the elegance of
having a web-accessible API so I can use the images anywhere.

And of course, IE8 and below don't speak SVG.

------
nwh
There's Photoshop scripts that will export a single image in a bunch of sizes.
That would probably work in the interim.

