183 points · by based2 · 10y ago · 46 comments
[+] Really good for common "take an arbitrary user upload; grab info to crop it from your web app; crop and resize to appropriate dimensions" sorts of tasks.
They claim support for over 200 formats, some of which surely have exciting scripting functionality that no one ever uses:
http://www.imagemagick.org/script/formats.php
And there have been recent code execution vulnerability reports:
Now libpng (e.g.) has issues as well but if at all possible I would try to restrict the input format and process only with software for the specific format.
OSS is a good choice because not every developer works on a Mac and with binary apps. You can hack quite a few quick/dirty tools to deal with repetitive tasks. Having said that Apple Preview is a pretty useful tool.
[edit] grammar
This image processing system would be very useful to have on the client.
(Why can't we still use arbitrary stuff on the client that was written for the server?)
asm.js and WebAssembly could very well change this in a few years.
Right now you can still port GraphicsMagick to emscripten you'd just have to accept a performance hit on the parts that rely on SIMD.
Interesting. I also have a use case for this though I wasn't sure how easy it would be to bundle something like GM with my Electron app. Have you any insights on this? I'm targeting both Win and Mac.
I later found a project called 'jimp', which is more or less similar to gm but written in pure JS, and which made it easy to chain calls together into nontrivial edits. Since it has no native dependencies it would probably be easier to bundle with electron as well. Presumably it's slower than gm of course (in my case that didn't matter, so I never looked back).
If you're using asar packages in your final app make sure it extracts those binaries then do a child_process.spawn
Lesson learned: if processing PSD files is critical to your project, you'll want to favor ImageMagick over GraphicsMagick. The author of GM admits the parser of PSD is not the best so it's something to keep in mind.
[1]Flickr and Etsy used GM on their backends:
http://www.slideshare.net/jallspaw/operational-efficiency-ha...
http://www.web2expo.com/webexsf2009/public/schedule/detail/8...
[2]https://sourceforge.net/p/graphicsmagick/bugs/242/
[3]also some bonus links on why PSD is very difficult to parse correctly:
https://github.com/gco/xee/blob/master/XeePhotoshopLoader.m?...
http://blogs.adobe.com/jnack/2009/05/some_thoughts_about_the...
I'm not in love with the CLI for either, but GM's is better and I like that it's all collected under one roof rather than a whole bunch of separate commands.
I do wish the projects could merge back into one and have the best of both. I also wish they were better at color handling, resizing needs to be done at a higher bit depth, better support for converting between modern color spaces, etc.
I love sips on my mac because it's fast, but I'm not sure if anything's a better cross-platform choice for basic batch operations on images, or for the backend of a web service, than GraphicsMagick.
1) What resolution were the source files?
2) What upscaling options did you use?
3) What multiple of the original file size did you go up to? Were you limited by the quality of the upscaling, or did you just decide on the size of print and dpi, and multiply?
I had enough trouble downscaling such large images that I ended up writing my own downscaling in my renderer so that I wouldn't have to use GraphicsMagick or anything else, but of everything I ever tried, GraphicsMagick was the best at handling enormous images.
FWIW, I've never been happy with any upscaling. If you do have the option to render at your target res and not use upscaling, that's ideal. If you must upscale, it's hard to find anything that can do more that 2-3x without noticeable artifacts or visible blurriness.
As I understand it some of the IM features are important for scientific image processing, HDRI or deep processing pipelines where rounding errors could accumulate.
Regardless, whether it's my incompetence or imagemagick itself, I don't have very good associations with the library.
https://github.com/jcupitt/libvips http://www.vips.ecs.soton.ac.uk/index.php?title=Libvips
Options!