Langue: en

Version: 110743 (mandriva - 01/05/08)

Section: 1 (Commandes utilisateur)


clens - Removes image distortions in jpeg images introduced by camera lenses.


clens [option] <jpeg_filename>


clens is a Linux port of Thomas Niemann's PTLens for Windows. You can find PTLens at Unlike PTLens, clens is a command line program.
  In order to correct lens distortions in your images you will need lens calibration data. See the web site listed above for a complete description of the lens calibration file format. You can download excellent lens calibration data from the same site.
  You will also need a stitcher program. The stitcher program is what actually performs the image warping to remove lens distortions. clens creates script files that the stitcher program reads and then calls the stitcher program itself. The script file that clens produces is compatable with two different stitcher programs that I know of. One is PTStitcher, the other is nona. PTStitcher is part of the Panorama Tools toolset and nona is part of hugin. Finally, both of these use the Pano12 library which also must be installed on your computer.

clens will get some of the information it needs from EXIF data that digital cameras store in the JPEG files they write. If the EXIF data is missing, clens will skip that image and continue on to the next. Scanned images, for instance, cannot be corrected with clens.


-u, --unscaled
Do not scale the corrected image to remove black borders that result from lens correction. The warping done to correct images for lens distortions usually results in an image that is no longer rectilinear. The default for clens is to scale the image just enough such that a rectilinear region containing only image data can be produced with the same dimensions as the input image.
-l, --lens <lens_descriptor>
Tell clens that the lens used when the picture was taken was <lens_descriptor>. clens will use that string when looking for lens correction coefficients. The default is "Standard", which is the appropriate identifier for lenses that are permanently attached to the camera. You can use the -L option to see a printout of all calibrated lenses for the camera used to take a given picture.
Tell clens to print out all lenses found in the calibration data that are compatable with the camera used to take the input picture, then exit. No corrections are made.
-s, --stitcher <full_path_to_stitcher>
Tell clens which stitcher to use. Currently supported stitchers are PTStitcher and nona. This string is actually used to exec the stitcher program so, if the stitcher is not on your path, you need to give the full path. The default is PTStitcher, and it's assumed to be on the path.
-p, --profile <full_path_to_profile.txt>
Tell clens where profile.txt is. The entire path must be specified. There is no default for this option. You may also specify this information in an environment variable named "CLENS_PROFILE".
-a, --append <appended_text>
Tell clens to append <appended_text> to the input filename to construct the output filename. The default is "_pt".
-q, --quality <quality_factor>
Use <quality_factor> when creating JPEG output files. <quality_factor> should be an integer from 0-100. The default is 90.
Output help information and exit.
Output version information and exit.
Use TIFF as the output file format. Default is JPEG.
Use JPEG as the output file format. This is the default.


All examples assume the file "profile.txt" is in ~/profiles.

Correct the file "dog.jpg" and put the result in "dog_pt.jpg" using jpeg quality factor 90.

clens -p ~/profiles/profile.txt dog.jpg

Correct all jpg files in the current directory using the program defaults. Note that all input images will be corrected using the Standard lens correction coefficients for the camera used to take the picture.

clens -p ~/profiles/profile.txt *.jpg

Print out all lenses that have been calibrated that are compatable with the camera used to take "dog.jpg".

clens -p ~/profiles/profile.txt --Lenses dog.jpg


Tim Jacobs <>