Hot pixel fix in Ubuntu

When I take photos indoors I tend to switch the flash off on my Nikon D40 because it’s just too harsh.  Instead, I bump up the ISO and practice my steady hand without flash.

I was looking through the resulting photos and noticed there were some coloured pixels that were showing in the same place in all the photos – you can see some red and green specks in this image (click the image to see the full size).

hotpixelsSo I set about seeing if I could fix this. Being an Ubuntu user, it had to be an Ubuntu fix too, though, I did find Pixel Fixer for Windows. After a bit of hunting, I found a post on which pretty much had the solution.

The fix

The basic steps are:

  1. Take a blackout-out picture with the lens cap on
  2. Produce a dead pixel map on the blacked-out image using jpeghotp (this is just a textfile with the coordinates of the spots).
  3. Use jpegpixi with the dead pixel map and the spotty input image to produce the cleaned up version.

The blacked-out picture

I struggled for a bit trying to get a blacked-out photo with the hot pixels on, in the end I took a photo using exactly the same settings as the images that had the spots on, and that worked for me.  Incidentally, ISO 1600, f5.6 shutter 1/6s.

blacked-out photo


This isn’t installed by default, but running

$ sudo apt-get install jpegpixi

installs both jpeghotp and jpegpixi.

Then it’s just a matter of calling

$ jpeghotp blacked-out-photo.JPG pixelmap.txt


You can run this one by one on the photos using the command

$ jpegpixi -f pixelmap.txt input-photo.JPG output-photo.JPG

(note, the description on the site had the -f option in the wrong place.)

But you can also run this over all the files, using jhead (I’m using this to make sure the camera’s meta information isn’t lost), which will also need installing:

$ sudo apt-get install jhead
$ jhead -cmd "jpegpixi -f pixelmap.txt &i &o" *.JPG

and that’s it.

hotpixels hotpixels removed

Be Sociable, Share!
    This entry was posted in Programs, Ubuntu and tagged , , , , , , , . Bookmark the permalink.