Aaron Isotton

Name

unweave — Removes artifacts from weave interlacing from images

Synopsis

unweave [ -afhpvV ] [ -i INTERPOLATOR ] [ -k {{even} | {odd}} ] [FILE...]

Description

unweave opens each file on the command line, removes the artifacts generated by weave interlacing, and overwrites the original file (except if -p is specified).

The artifacts are removed by simply removing either the odd or the even field of the image, and interpolating them from the other field.

Options

-a

Auto-detect whether the images contain artifacts, and only interpolate the files which do.

If the auto-detector detects artifacts in an image, then the image is processed as if -a had not been specified. If the auto-detector detects no artifacts, then the process is different:

  • If neither -f nor -p are specified, then the file is not touched.

  • If -f is specified but -p is not specified, then the image data is not modified, but the file is recompressed and the original overwritten.

  • If -f is not specified but -p is specified, then the input file is copied (not recompressed) to the output file.

  • If both -f and -p are specified, then the image data is not modified, but the file is recompressed and written to the output.

The autodetection algorithm works “quite well”, but it is not perfect. It is good enough for most purposes, but you should try it out yourself before deploying it on a large-scale basis.

-f

This option is only useful together with -a. If it is specified, it forces recompression of all files, whether the image data was modified or not.

-h

Display some help and exit.

-i INTERPOLATOR

Use the specified interpolation method. The default is linear. Currently the following interpolation methods are supported:

copy

If the odd field is kept, copy each odd row to the row below. If the even field is kept, copy each even row to the row above. This generates jaggy images. If you do not understand what this means, then this method is probably not what you want.

linear

Do a linear interpolation between the pixel exactly above and exactly below the pixel to be interpolated.

-k even|odd

Keep the even or the odd field. “Keep odd” is the default.

-p

Treat the file names as “source-destination” pairs, and do not overwrite the original files. The file names must be specified in this order: SOURCE1 DESTINATION1 SOURCE2 DESTINATION2

Obviously, you must specify an even number of files.

-v

Be verbose.

-V

Display version information and exit.

Image Formats

unweave uses the ImageMagick library for image I/O, and thus supports all the formats supported by ImageMagick.

The format of the input file is auto-detected; the format of the output file depends on the specified file extension. Since it is not possible to specify compression parameters, it is recommended to use a lossless format (such as PNG) for output. You can later change the file format with other tools such as convert(1).

Examples

Unweave an image using the linear interpolation method and keeping the even rows:

unweave -i linear -k even test.png

Unweave two a.png and b.png and write them to a_dest.png and b_dest.png:

unweave -p a.png a_dest.png b.png b_dest.png

Author

unweave is copyright (C) 2005 Aaron Isotton . You may use it under the terms of the GNU General Public License.

Source code and newer versions are available from http://www.isotton.com/utils/unweave/.

Report bugs to with “[unweave]” as the first word of the subject.

See Also

ImageMagick(1)