Ask HN: Serving Vector Images Via Web API?
2 comments
You can embed SVG into HTML if you wish.
Basically, browsers support SVG.
Basically, browsers support SVG.
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.
And of course, IE8 and below don't speak SVG.
There's Photoshop scripts that will export a single image in a bunch of sizes. That would probably work in the interim.
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:
example.com/vectors/logo.png?width=100
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.
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.