6 ms·
Ask HN: image scaling on the fly
Hi,
I've built some mobile sites & apps the last few years and rescaling images keeps popping up.
Ideally I would want something like this:
http://scal.er/w40-a1:1/http://path/to/image
this would generate a square thumb, 40x40.
I would be willing to pay for such a service.
- Mentat_Enki 16y agoWas there a question being asked here? If you are looking for a programmer-for-hire, there are freelance sites for that sort of thing. This isn't even an hard/interesting problem, and anyone who could "build a mobile site/app" should be able to code up this trivial service in minutes.
- Erlend 16y agoSorry, I wasn't clear enough earlier. I have used imagemagick/GD previusly, but there are some hassle involved in setting up this for each project/client (cron job for cleaning up thumbs, space considerations, not all ISP I use for clients have GD installed etc) I agree that writing an ad-hoc image scaler is simle. However, writing a quality general one that handles different formats, image quality, aspect ratio, smart cropping etc..is not trivial.
- Mentat_Enki 16y agoRighty-o. Didn't mean to sound annoyed, but there has been a bit more Craigslist-y trolling-for-programmers-for-hire than usual lately it seems, and that kinda stuff needs some trouncing IMHO. :) Also, you are going to be limited to the tools for processing images that are out there for the most part, which sadly means ImageMagick and/or GD. But not SO sadly, as both of those (while annoying to deploy, granted...) have decent bindings to everything, support a pretty good selection of images types, and have params for controlling the aspects you mentioned (except maybe smart cropping). Everything else is arithmetic and designing a clean, RESTful URL scheme for invoking it. I guess I meant trivial in the sense that all these things are solved problems or only require a bit of time/cleverness. I built one of these a few years ago using PHP/GD, and it performed admirably (and did everything except smart cropping in your aforementioned list...) So, feel free to hit me up if you get stuck on any specifics. Been there done that, and can commisserate if nothing else. ;)
- Erlend 16y agoThanks for that, I'll let you know if I get stuck.
- hernan7 16y agoWhy not use ImageMagick? I have used it to create thumbnails for a demo website and they looked OK. Does it have any performance/ aliasing/ whatever issues I'm not aware of?
- johngunderman 16y agoImageMagick is gold for this sort of thing. I'm actually working with it as I type :)
- hkuo 16y agoI've used ImageMagick and it works great. Though I think many average developers who don't tinker with servers would have a harder time picking it up.
- theIntuitionist 16y agoI'd be happy to build you such a service. Would be quite simple. email me- theIntuitionist@idont.no
- tjarratt 16y agoOff topic, but why do you have all of your files browsable at http://idont.no http://idont.no ? You should set up a landing page at least, so visitors don't just see /www directory.
- anarchitect 16y agoI think urlimg might be what you are looking for... http://urlimg.com/ http://urlimg.com/
- Erlend 16y agoThanks, will take a closer look, but pricing seems off (1 cent/mb/month over 50mb)
- raystar 16y agoThere is http://imagejuicer.com/ http://imagejuicer.com/, that seems to do what you want.
- thinkzig 16y agoHas anyone here used Image Juicer? It looks interesting but I found the documentation page to be pretty lacking. The simple example they show just allows you to pass a height and width parameter, but the home page says you can do cropping, watermarking, etc.
- raystar 16y agoFrom their site: You can pass other info in the outputs hashes, like labels, your own ids, or whatever. That extra info will be passed back to you in the response JSON. So I assume it is a case of emailing them and asking for an exhaustive list of what can be passed to their api, the documentation definitely needs work.
- hkuo 16y agoThis looks like the answer.
- Erlend 16y agoThanks, but looks like its mainly for background jobs and not built to serve images on the fly.
- andrewingram 16y agoAt work I developed a wsgi script that use Python Imaging Library to resize images on demand. You can see it in action here: http://dyn4.media.forbiddenplanet.com/products/2148557.jpg.size-300_square-true.jpg http://dyn4.media.forbiddenplanet.com/products/2148557.jpg.s... http://dyn4.media.forbiddenplanet.com/products/2148557.jpg.size-300_square-true.gif http://dyn4.media.forbiddenplanet.com/products/2148557.jpg.s... Basically, if you chop off the dyn4 sub-subdomain and everything after .jpg you can see the original unmodified image. You can also change the extension at the end to change the format of the image (jpg,png or gif). We cache the files to /tmp which we periodically clear out. Whilst it might be more efficient of going down the route of pre-generating all the images we'll need, it's very convenient being able to do it on the fly and to be honest for a site of our size (225,000 visits/month) it's barely a spec on the CPU load of our media server. There's also an apache module that uses ImageMagick to do something similar: http://github.com/beetlebugorg/mod_dims http://github.com/beetlebugorg/mod_dims I have to be honest though, I prefer the API for my version and it gives the files a meaningful name in the /tmp folder as well as the user's internet history. Unfortunately my version isn't open source (yet?) and the code is a bit of a mess, but it's something we have considered opening up.
- wan23 16y agoI've thought the same thing. Seems like something that needs to be done over and over. It seems like a good potential business idea as long as it's cheap enough.
- deleted 16y ago[deleted]
- macca321 16y agoI wrote a HTML=>PNG service last week (http://htmltoimage.tenprinthello.com http://htmltoimage.tenprinthello.com), so it's just a hop to an image resizer. If you want one developed, please contact me, my email is on my blog @ http://www.adverseconditionals.com http://www.adverseconditionals.com
- l4u 16y agotry http://cdn-cloud.appspot.com/ http://cdn-cloud.appspot.com/ despite the name "cdn", it provides functions for scaling
- Erlend 16y agoThanks, looks useful, but didnt find any Terms of service or pricing info..
- cromulent 16y agohttp://wiki.nginx.org/NginxHttpImageFilterModule http://wiki.nginx.org/NginxHttpImageFilterModule
- audionerd 16y agoI've been impressed with Dragonfly, "a Rack-based ruby gem for [image] processing/encoding on the fly" http://blog.new-bamboo.co.uk/2010/1/2/dragonfly
- anathem 16y agoI'm currently wrapping up work on an image processing module with a client. If you want I could build a dedicated service for you. If you are running your own site, and using nginx, there's an image processing module for it that is a match for your requirement: http://wiki.nginx.org/NginxHttpImageFilterModule http://wiki.nginx.org/NginxHttpImageFilterModule
- Erlend 16y agoThanks for that, but Im looking for a "pay as you go" service.
- Concours 16y agoyou may want to try this: http://gaia-git.sourceforge.net/ http://gaia-git.sourceforge.net/ it targets mobile devices, so could be what you are looking for.