CS494 Lecture Notes - Some Photo Editing Tips with Gimp and Convert


Imagemagick's Convert and Gimp

These are two free programs that are pretty much all you need to do a lot of powerful photo editing. If nothing else, convert lets you convert between JPG, PNG, TIFF, PDF and EPS. But it does a lot more -- I'll give you an example at the end of these notes.

Brightening a Dark Photo

The most common mistake that automatic cameras make is metering. Sometimes it's not the camera's fault (like when you take a selfie in front of a window on a bright day). But a lot of times the camera will meter for the overall lighting, which will leave the subject dark. Or, it will simply be too dark, and the camera will take a dark picture. So, it's a good to know how to brighten a photo. Here's what I do.

Here's an example -- this is a picture that my daughter-in-law took with her iPhone of my granddaughter at a UT game. It is dark and drab, but it is a nice picture.

Open it up in Gimp, and do the following three steps. These will not alter the picture:

The layer window will show two layers -- the original one on the bottom, and the duplicate layer with the mask on top of it:

You are going to mess with two things on this window -- the "Mode" and the "Opacity". Change the mode to "Screen". What that does is blend the original with the mask by sampling. It brightens the photo by brightening the darks a lot and the lights a little. The picture is already getting better:

You mess with the opacity value to strengthen or reduce the effect. I'm not going to do it here. However, I am going to mess with the photo some more, because I'd like some more "depth" in the picture, and I want those baloons to be brighter.

First, I'm going to duplicate the layer again (Shift-Command-D), which duplicates the mask & screen, brightening it again. I do it one more time. It's a bit overdone right now, and it feels pretty flat. Here are the two brightens:

Now I merge the layers down to one with Command-M (Image menu, merge visible layers), then "Merge" on the dialog box. And I bring up the curves tool (Colors menu - Curves. For me, I can just press "C", but I think I changed that from the defaults). Here's a screen shot:

What I like to do is bump up the contrast, by pulling the curve down at the bottom left:

Then I pull the curve back at the middle, to push the mid-tones and highlights back to what they were:

You can get some really nice looking pictures from dark photos with this technique. With this picture, I also went to the Hue-Saturation tool and bumped up the saturation to "50", so that the balloons would be better. This gave the baby some rosier skin color:

Ever the twiddler, I went back to curves and gave her some more contrast again -- the final picture:


When you're feeling lazy, you can simply use the curve tool

It's easy to brighten simply with the curve tool by pushing up the highlights (and here, keeping the low values down). This is on the original picture:

It works, but I don't like it as much as using the mask/screen above, because it blows out the high pixel values. For example, there's no sky above. Sometimes, though, you want contrasty pictures.

The curve tool can resurrect pictures from darkness. For example, on this one, the flash didn't fire, but I am still able to get something from it. The middle picture was just with the curve tool. Then in the right one, I desaturated it and messed with the curves.


Or you can use "Sigmoidal-Contrast" with imagemagick

The -sigmoidal-contrast command in the convert program also gives you a quick-and-dirty way to brighten pictures. To brighten P01.jpg a little, here's the command:
UNIX> convert P01.jpg -sigmoidal-contrast 1,0 tmp1.jpg
Increase the "1" to get more brightening. Below, I show values from 1 to 5:


A few more hints in no particular order


Convert

I don't have time to tell you about convert. It's a great tool for composing photos. Here's an example of using convert to make a labeled collage for a photo frame. Obviously, I wrote a program to generate the convert command, but I'm hoping this shows you how powerful convert is (BTW, if you want the program, let me know -- I'm not possessive):
UNIX> ls -l Fish-*.JPG
-rw-r--r--  1 plank  staff  2152216 Sep 28 11:04 Fish-Alex.JPG
-rw-r--r--  1 plank  staff  8904152 Sep 28 11:04 Fish-Chris.JPG
-rw-r--r--@ 1 plank  staff  1009049 Sep 28 11:04 Fish-JCJ.JPG
-rw-r--r--@ 1 plank  staff  1887030 Sep 28 11:04 Fish-Jeff-Alex.JPG
-rw-r--r--  1 plank  staff  6268208 Sep 28 11:04 Fish-Jeff.JPG
-rw-r--r--  1 plank  staff  5087292 Sep 28 11:04 Fish-John.JPG
-rw-r--r--@ 1 plank  staff  3429525 Sep 28 11:04 Fish-Thor.JPG
-rw-r--r--@ 1 plank  staff  3089771 Sep 28 11:04 Fish-Tolu.JPG
-rw-r--r--@ 1 plank  staff  5045460 Sep 28 11:04 Fish-Tom.JPG
UNIX> cat fish.sh
convert -size 2600x1664 xc:white \
  Fish-Tolu.JPG -geometry 655x797+15+15 -composite\
  Fish-Jeff-Alex.JPG -geometry 820x797+680+15 -composite\
  Fish-Tom.JPG -geometry 536x706+1510+15 -composite\
  \( Fish-Alex.JPG -scale 530 -crop 529x706+0+0 \) -geometry 529x706+2056+15 -composite\
  \( Fish-JCJ.JPG -scale 449 -crop 448x823+0+0 \) -geometry 448x823+1510+731 -composite\
  Fish-Thor.JPG -geometry 617x823+1968+731 -composite\
  Fish-Chris.JPG -geometry 488x732+15+822 -composite\
  \( Fish-John.JPG -scale 488 -crop 487x732+0+0 \) -geometry 487x732+513+822 -composite\
  Fish-Jeff.JPG -geometry 490x732+1010+822 -composite\
  \( -size 2570x85 -background '#0450E9' -fill 'white' -stroke 'none' -gravity Center  label:'Triumphantly Displaying our Salmon - Soldotna, AK - July, 2016' \) \
  -geometry 2570x85+15+1564 -gravity NorthWest -composite  Fish-Collage.jpg
UNIX> sh fish.sh
UNIX> 


Converting PDF to JPG

Do:
UNIX> convert -density 300 xxx.pdf -quality 100 xxx.jpg
Trust me on this one.