Image converter of the exactimage toolkit
econvert [option...] [{-i | --input} input-file...] [{-o | --output} output-file...] econvert {-h | --help}
ExactImage is a fast C++ image processing library. Unlike many other library frameworks it allows operation in several color spaces and bit depths natively, resulting in low memory and computational requirements.
econvert is a command line frontend for the image processing library and mimicks ImageMagick's convert. However econvert syntax is not compatible with convert.
-i file, --input file
Read image from the specified file. Optionally, filenames can be prefixed with format name, e.g. jpg:- or raw:rgb8-dump.
-o file, --output file
Save output image to the specified file. Optionally, filenames can be prefixed with format name, e.g. jpg:- or raw:rgb8-dump.
-a file, --append file
Append output image to the specified file. Existing image must have the same width as the appended one. Optionally, filenames can be prefixed with format name, e.g. jpg:- or raw:rgb8-dump.
--compress method
Use the specified compression method for writing images, e.g. G3, G4, Zip, ... The default depends on the output format.
--decompress method
Use the specified decompression method for reading images.
--quality n
Use the specified quality used for writing compressed images. Valid values are integers from 0 to 100. The default is 75.
--resolution xdpi [ydpi]
Set metadata resolution.
--size width height
Set image dimensions for raw images.
--split file...
Split the image in Y-direction into multiple images.
--bicubic-scale x
Scale image data with bi-cubic filter. Use scale factor x.
--bilinear-scale x
Scale image data with bi-linear filter. Use scale factor x.
--box-scale x
(Down)scale image data with box filter. Use scale factor x.
--ddt-scale x
Scale image data with data dependent triangulation. Use scale factor x.
--nearest-scale x
Scale image data to nearest neighbour. Use scale factor x.
--scale x
Scale image data using a method suitable for specified factor x.
--thumbnail x
Quick and dirty down-scale for a thumbnail. Use scale factor x.
--crop x y w h
Crop the specified area out of the image.
--fast-auto-crop
Fast auto crop.
--flip
Flip the image vertically.
--flop
Flip the image horizontally.
--rotate n
Rotate the image n degrees.
--brightness x
Change the image brightness.
--contrast x
Change the image contrast.
--saturation x
Change the image saturation.
--lightness x
Change the image lightness.
--hue x
Change the image hue.
--negate
Negate the image.
--gamma x
Change the image gamma.
--normalize
Transform the image to span the full color range.
--colorspace colorspace
Convert image colorspace. Valid values are: BW, BILEVEL, GRAY, GRAY1, GRAY2, GRAY4, RGB, YUV and CYMK.
--floyd-steinberg n
Perform Floyd-Steinberg dithering using n shades.
--riemersma n
Perform Riemersma dithering using n shades.
--blur stdev
Perform gaussian blur with standard deviation stdev.
--deinterlace
Shuffle every 2nd line.
--edge
Detect edges.
--convolve x11 x12 ... x1n ... xn1 xn2 ... xnn
Convolve the image using the specified convolution matrix.
--foreground color
Set foreground color.
--background color
Set background color.
--font font
Use the specified font for drawing text.
--text-rotation n
Use the specified text rotation.
--text x1 y1 height text
Draw text.
--stroke-width n
Set stroke width for vector primitives.
--line x1 y1 x2 y2
Draw a line.
-h, --help
Display help text and exit.
Image data must be read using -i or --input, processing routines are selected by their name with two leading dashes (e.g. --rotate) and at any point the data might be written into a file with -o or --output, for example:
econvert -i lenea.tiff --box-scale 0.5 -o medium.png --box-scale 0.5 -o little.png
The library delays image decoding as much as possible and provides lossless algorithms to work on compressed data (such as JPEGs) directly:
econvert -i AV220-Scan.JPG --resolution 300x300 -o 1.jpg --rotate 90 -o 2.jpg --rotate 180 -o 3.jpg --rotate -90 -o 4.jpg --flip -o 5.jpg --flop -o 6.jpg --scale 0.25 -o thumb.jpg
In this example 1.jpg will be created from the original JPEG DCT coefficients, those coefficients will be rearranged and 2.jpg, 3.jpg, 4.jpg, 5.jpg and 6.jpg will be written without any additional loss in quality. Only at the end, for image thumb.jpg, the DCT will actually be decoded – but due to the accelerated JPEG scaling only partially.
When 1 bit, black and white, images are scaled down, the output often looks bad, as the library algorithms always operate in the color-space the image data is stored in. To work around this problem, the colorspace must be changed (e.g. to 8 bit gray) before applying the box scaler. At the end the result might be converted back to just a few shades of gray such as 2 or 4 bit:
econvert -i avision-bw-scan.pbm --colorspace gray8 --box-scale 0.125 --colorspace gray2 -o thumb.png
If you don't care about quality, only about throughput, you can force nearest neighbor scaling by just specifying a scale factor the JPEG decoder can accelerate (½, \(14, or 1/8) and apply the remaining scaling manually. To achieve faster scaling with the effective factor 1/3:
econvert -i big.jpg --scale .5 --nearest-scale 0.66 -o thumb.jpg
Wide range of digital camera RAW formats is supported. Usually decoding of RAW data should be transparent and automatic, however some formats also are also valid TIFF files and the embedded thumbnail might be picked by in favour of the actual RAW content. This this cases the dcraw decoder can explicitly be requested with the decoder prefix of the input parameter:
econvert -i dcraw:img_0123.cr2 ...
To quickly extract the embedded thumbnail preview, specify thumb as decompression method before the image is loaded:
econvert --decompress thumb -i dcraw:img_0123.cr2 ...
It is possible to load arbitrary raw data via the raw: codec specification; color-depth (colorspace) and size for the raw data have to be explicitly specified:
econvert --size 1696x32 --colorspace rgb8 -i raw:data-file ...
Jakub Wilk <[email protected]>
Wrote this manual page for the Debian system.
\m[blue]http://www.exactcode.de/site/open_source/exactimage/\m[]
This manual page incorporates texts found on the ExactImage homepage.
This manual page was written for the Debian system (and may be used by others).
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 2 or (at your option) any later version published by the Free Software Foundation.
On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL-2.