Recreating output (was using bash scripts before)

The MagickWand interface is a new high-level C API interface to ImageMagick core methods. We discourage the use of the core methods and encourage the use of this API instead. Post MagickWand questions, bug reports, and suggestions to this forum.
Post Reply
CalvinMorrison
Posts: 1
Joined: 2012-06-19T13:13:53-07:00
Authentication code: 13

Recreating output (was using bash scripts before)

Post 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
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Recreating output (was using bash scripts before)

Post 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
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply