GraphicsMagick Image Processing System
graphicsmagick.org
graphicsmagick.org
[+] 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.
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.
If you're using asar packages in your final app make sure it extracts those binaries then do a child_process.spawn
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).
With jimp, everything basically did what it said on the tin. I remember wondering why such a useful library wasn't more famous.
The decoder.js script in jpeg-js is < 1000 loc, so I suspect this can be addressed if someone comes up with a reproducible case?
Edit: I'll happily try to do it if this isn't resolved by the time I get around to needing to use jimp / jpeg-js.
My personal favourite is node-canvas. It simply brings the HTML5 canvas api to node.
The gory details and a few attempts at higher quality scaling algorithm implementations are on SO: http://stackoverflow.com/questions/18922880/html5-canvas-res.... TL;DR: sending the image to the server and having GM scale it is faster and more reliable than your own scaling algorithm in single-threaded browser JS.
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
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.
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.
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.
I'd worry a little about textured background and what happens in areas of high detail, but I'm speculating. You can see resolution artifacts in the waifu2x examples. But those source images are tiny -- it may behave completely differently on a 20MP image. It also depends on what material you print onto. Canvas and some popular art papers have a lot of texture that can hide the 1-2 pixel sized artifacts.
If you are taking the photos yourself, one option you might consider is to take overlapping photos of sub-portions of the woodblocks and stitch them together using a panorama editor like Hugin to get a source image that is at or above your target resolution.
If you have no other options but upscaling, do some experiments with the cheapest printing service you can find that will print 24x36 inches at 300dpi. There are a bunch online that will mail you prints very fast. If you're in the US, Costco does ridiculously cheap photo prints at 24x36. Experiment with upscalers and see what works best for the photos you have. You might find that you don't like any of them, or you might find out that you can't tell much difference between waifu2x and generic upscaling, or you might find out that waifu2x is perfect and unbeatable.
Regardless, whether it's my incompetence or imagemagick itself, I don't have very good associations with the library.
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.
https://github.com/jcupitt/libvips http://www.vips.ecs.soton.ac.uk/index.php?title=Libvips
Options!