Saturday, December 20, 2014

Silly Preview Bug


Here's a silly Preview bug and a work-around. If you know a better work-around, let me know.

Preview is a document viewer and editor for the Mac. One thing it allows is "annotation"; that is, you can take an existing .jpg file (for example) and add things like arrows, rectangles, and so forth. I use the annotation for, among other things, putting red rectangles around parts of articles or papers I'm interested in.

However, it has the following silly bug. If you use Preview to look at a grayscale JPG, and then annotate it by adding color in any form (say, a red rectangle), you'll see the red rectangle as you edit it. However, if you re-open the changed file after saving, you'll find (to your surprise and dismay) that the red rectangle has magically become gray. Apparently Preview is not smart enough to understand that if you add color to a grayscale JPG, you want to save it as color JPG.

I couldn't figure out any way at all to get Preview to behave in the way I expected, and a web search didn't produce any suggestions to fix the problem. So here's a kludge to solve the problem. In a Terminal window, type a line like the following:

convert inputfile.jpg -colorspace HSL outputfile.jpg

This uses ImageMagick to change the file, which you can then use Preview to annotate and get the expected behavior. Oddly enough, for some reason I don't understand, using "RGB" in place of "HSL" doesn't work.

1 comment:

Unknown said...

On the other hand you could you Skitch