[magick-users] using clone to avoid writing intermediate output to HD?

Anthony Thyssen anthony at griffith.edu.au
Mon Aug 27 20:06:31 PDT 2007


Dieter Vanderelst on  wrote...
| Hi list,
|
| I'm trying to doing the following using IM:
|
| -read in a grayscale image
| -perform a difference of gaussians filter
| -(optionally: finding the location of the maximum value)
| -saving the image
|
| Now I've written this little batch file, which takes 2 parameters (input
| and output images):
|
| ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
| convert %1 -blur 0x15 blur1.jpg
| convert %1 -blur 0x30 blur2.jpg
| convert -compose difference blur1.jpg blur2.jpg difference.jpg
| convert -normalize difference-0.jpg %2
| ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
| As you can see, this script writes some intermediate files to the disk
| and reads them in again. However, after reading the IM documentation I
| think this could be avoided using +clone and Image Stack.
|
The thrird line was missing   -composite  to actually DO IT.

here you go..
Note +clone clones the 'last' image   -clone 0  gets the 'first' image

   convert  input.png  \( +clone -blur 0x15 \) \
            \( -clone 0 -blur 0x30 \) \
            -delete 0   -compose difference  -composite \
            -normalize  output.png

NOTE:  JPG is a lossy image format.


  Anthony Thyssen ( System Programmer )    <A.Thyssen at griffith.edu.au>
 -----------------------------------------------------------------------------
``But that's fantasy for you. The Damsel gets to fly, while
    the Elf gets stuck in the mud.''  -- Piers Anthony `Bearing an Hourglass'
 -----------------------------------------------------------------------------
     Anthony's Home is his Castle     http://www.cit.gu.edu.au/~anthony/


More information about the Magick-users mailing list