Added -operator command to convert/mogrify

Bob Friesenhahn <[email protected]> Tue, 16 Mar 2004 00:01:52 -0600 (CST)
Newsgroups gmane.comp.video.graphicsmagick.tools,gmane.comp.video.graphicsmagick.core
Message-ID <[email protected]>
The latest GraphicsMagick 1.1 source snapshot (1.1.020040315) supports
a new -operator command to apply an arithmetic or bitwise operator to
a specified image channel, or all image channels.

As a real world example, someone sent me a TIFF consisting of 12 bit
data stored in the lower 12 bits of a 16 bit image.  The result is an
image which appears black.  Multiplying the pixel quantums by 16
restores the original image:

  gm convert diskette1.tif -operator all multiply 16 out.tif

It is also fun to play with exclusive or, since applying an exclusive
once results in a destroyed image, but re-applying the exclusive or
retores the original image.

  gm convert good.tif -operator all xor 170 scrambled.tif
  gm convert scrambled.tif -operator all xor 170 good.tif

Here is a way to discard the low order bits of an image:

  gm convert image.tif -operator all rshift 3 -operator all lshift 3 reduced.tif

or for a Q:8 build of GraphicsMagick, you could use

  gm convert image.tif -operator all or 248 reduced.tif

I would like to hear any comments regarding the operation of this
functionality so that it can be as perfect as possible for the 1.1
release.

I am considering changing the numerical argument to a floating point
value since it may be useful for the arithmetic operations, and a
floating point type can easily be converted to integer to support the
bitwise operations.

Bob
======================================
Bob Friesenhahn
[email protected]
http://www.simplesystems.org/users/bfriesen



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click