ljcrop: A GUI tool for lossless JPEG cropping in Unix


By Marshall Perrin

Cropping a JPEG image in a graphics package such as the Gimp involves decompressing and then recompressing the image data. This is a lossy process and can result in image degradation. I doubt you're going to repeatedly crop the same image
over and over again, so perhaps the slight loss of quality is no big deal in most cases. Still, why degrade your images if you don't have to?

Recent versions of the excellent jpegtran tool provide lossless jpeg cropping at the command line. But while the command line is good for many things, interactive image manipulation is not one of them. ljcrop is a graphical front-end for jpegtran that allows you to just draw a bounding box around the region of the image you wish to keep, and then crop to that region.

See the list of lossless jpeg applications for other similar programs. (Most are for Windows, unfortunately.)

[ Download ljcrop ]

  Usage:

 ljcrop [filename]

Use the zoom buttons to size the image appropriately, and the mouse to draw a bounding box around the region of the image you wish to crop. Pressing the "Crop" button will create a new output file called <inputfilename>_cropped.jpg which contains the cropped portion. All extra JPEG markers such as EXIF headers are propagated to the cropped image. The original file is not modified in any way. If there already exists a file named <inputfilename>_cropped.jpg, it is overwritten.

 Requirements:

    This package requires
       Tcl/Tk(version >= 8.3)
       the Tcl Img package
       jpegtran including the lossless cropping patches.
            

 Several portions of this code are due to Richard Suchenworth, as posted to the Tcler's Wiki:
       http://mini.net/tcl/4025   http://mini.net/tcl/8479
 My thanks to him and all the other tclers, without whose many helpful
 postings I would never have gotten the hang of this language!


Marshall Perrin, 2003 August 23