ImageMagick help

Dear Lazyweb, ImageMagick is tormenting me again. Help.

I need a single incantation that I can apply to an arbitrary image, be it an RGB JPEG, a CMYK JPEG, a PDF, a PNG, or whatever, and have it resized and converted to a web-usable RGB JPEG.

Back in 2010 and earlier when I was using, I think, ImageMagick 6.6.3-0 and earlier, that incantation was:

convert -density 300x300 IN -resize 1280x1280 -colorspace RGB -strip OUT.jpg

The "-density" argument is needed to tell it to internally render vector-graphics inside Illustrator and PDF files in a high resolution instead of rendering them tiny and then scaling them up. The "-colorspace" argument is needed to tell it to convert CMYK images to RGB instead of just passing that through, because CMYK JPEGs do not display correctly in all web browsers.

However, as I bitched about a couple of months ago, something has gone completely wonky with recent versions of ImageMagick.

Here's a test case. Help me figure out how to make this work!

Three test input files:

Try running the permutations:

for c in RGB sRGB ; do
  for f in test[123].jpg ; do
    convert -density 300x300 $f -resize 1280x1280 -colorspace $c -strip `basename $f .jpg`-$c.jpg

Desired results: 1, 2 and 3.

When using colorspace "RGB", "test1-RGB.jpg" looks fine, but the other two come out solid black.

When using colorspace "sRGB", "test1-sRGB.jpg" comes out washed out (the blacks are light gray) but the other two look fine.

Even simpler test case:

convert rose: -colorspace RGB out.jpg    → black.
convert rose: -colorspace sRGB out.jpg   → fine.

I have tested this on MacOS 10.7.3 with ImageMagick 6.7.6-0 Q32 (installed with "port install ImageMagick +perl +jbig +q32") and on CentOS 5.4 / Linux 2.6 with ImageMagick 6.7.6-3 Q32 (installed from source with "configure --with-gslib --with-lcms --with-jbig --with-quantum-depth=32").

What's the fix?

Update: Turns out, ImageMagick hates being compiled with Q32. Rebuilding it with Q24 made the "all black images" problem stop. It didn't affect the "images are too dark or too light" colorspace problem, though, which I still have no idea about.

Tags: , , , ,

Be Your Own Screensaver

Human Face Video Mapping. There's a little more behind-the-scenes footage.

It seems to have been made by Oskar & Gaspar. Here's their demo reel:

Previously, previously.

Scene missing! Some videos in this post have disappeared. If you know of an accessible version of this video (search) or this video, please mail me so that I can update this post.
Tags: , , , , , ,

Mad Fashion Science

Lucy McRae:

Also, TED talk. Previously, previously, previously, previously.

Tags: , , , ,


Tags: , , ,

  • Previously