Page 1 of 1

Recreating output (was using bash scripts before)

Posted: 2012-06-19T13:18:16-07:00
by CalvinMorrison
Hi,

I'm doing some image processing for my work, and currently we write out a file, do some operations with convert, and then send it back to another program. To make this faster I decided to interface directly with the MagickWand API. things are going great so far.

Unfortunately I am having trouble getting the same output as I was before - though it looks to me I am using the same command

The command we use currently:

Code: Select all

convert \( -composite -compose Difference $output_dir/Masks/$setname/Background.png input.png \) \( -contrast-stretch 90%x0% \) \( -threshold 30% \) output.png
The functions I am calling:

Code: Select all

  MagickCompositeImage(mask, background, DifferenceCompositeOp, 0, 0);
  MagickContrastStretchImage(mask, 0.90, 0); 
  MagickThresholdImage(mask, 0.30);
The outputs are completely different, though I know that the image is being loaded correctly - so that isn't a problem.

Any Advice or obvious mistakes?

Thanks
Calvin

Re: Recreating output (was using bash scripts before)

Posted: 2012-06-19T17:26:50-07:00
by anthony
Your command line is BAD.

You MUST read images before trying to apply an operation on them if you expect IM to correct apply the right operator in the right order.

See IM Examples, Basics, Intro
http://www.imagemagick.org/Usage/basics/#cmdline

More importantly set the -compose setting BEFORE the operator that uses it -composite