Convert ... (+clone 0 ...

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
BrianP007
Posts: 49
Joined: 2013-12-13T09:54:14-07:00
Authentication code: 6789

Convert ... (+clone 0 ...

Post by BrianP007 »

Snibgo,
I was researching your original Convert command to restore blacks:

Code: Select all

convert ^
  original.tiff ^
  bad_black.tiff ^
  ( +clone 0 -colorspace Gray -level 0,5%% ^
    -write mask.tiff ^
  ) ^
  -composite ^
  out.tiff
The CLONE op, you specify the first image, index 0.
But, with +CLONE: "The +clone will simply make a copy of the last image in the image sequence, and is thus equivalent to using a argument of '-1'. "

It looks like you are specifying both the first and the last which would be both the original and the black. That would introduce an extra image onto the stack. Who is cloned, composted and converted (not to mention OUTed!).

I suspect your Kung-Fu has ventured beyond the documentation. Could you play-by-play the clone section?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert ... (+clone 0 ...

Post by fmw42 »

convert ^
original.tiff ^
bad_black.tiff ^
( +clone 0 -colorspace Gray -level 0,5%% ^
-write mask.tiff ^
) ^
-composite ^
out.tiff
This is erroneous syntax (probably a typo).

Try

convert ^
original.tiff ^
bad_black.tiff ^
( -clone 0 -colorspace Gray -level 0,5%% ^
-write mask.tiff ^
) ^
-composite ^
out.tiff

or if that fails, then perhaps he meant

convert ^
original.tiff ^
bad_black.tiff ^
( +clone -colorspace Gray -level 0,5%% ^
-write mask.tiff ^
) ^
-composite ^
out.tiff
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Convert ... (+clone 0 ...

Post by snibgo »

In that thread viewtopic.php?f=1&t=26821#p118493, I said "you might try something like this".

"Something like this" means I haven't tried it so you need to correct any typos or syntax errors or anything else.

As Fred says, my syntax was wrong. It should be "-clone 0" or "+clone". Without testing on your files, I don't know which is better.
snibgo's IM pages: im.snibgo.com
Post Reply