before:
![Image](https://s1.ax1x.com/2018/11/27/FVP3Eq.jpg)
after:
![Image](https://s1.ax1x.com/2018/11/27/FVP8U0.png)
Code: Select all
magick in.jpg -region 300x400+20+30 -alpha transparent +region -depth 8 out.png
Thank you very much!The version I used was 6.9.1-10, and I used this command:
magick in.jpg -region 300x400+20+30 -alpha transparent +region -depth 8 out.png
igenerate a fully transparent image, not the result I wanted.Would you please see what the problem is?
Code: Select all
convert in.jpg ( +clone -fill White -colorize 100 -fill Black -draw "rectangle 20,20,320,430" ) -alpha off -compose CopyOpacity -composite -depth 8 out.png
Thank you so much!This works!How do I implement this with the MagickWand C API?snibgo wrote: ↑2018-11-27T18:57:26-07:00 "magick" is a v7 command, but you have v6, so I'm surprised that works at all.
In some versions, "-region" didn't work. This longer command does the same job:
Code: Select all
convert in.jpg ( +clone -fill White -colorize 100 -fill Black -draw "rectangle 20,20,320,430" ) -alpha off -compose CopyOpacity -composite -depth 8 out.png
By starting small. Find the C MagickWand functions that correspond to the CLI operations: read, colorize, draw, composite, write. Then write the program.dxr528 wrote:How do I implement this with the MagickWand C API?
// +clone -fill White -colorize 100
i saved im_clone to local img file.just like this:snibgo wrote: ↑2018-11-28T07:01:08-07:00 The CLI "-alpha off" operates on all the images in the current list, not just one.
When debugging any image processing, it is useful to write image files at the different stages, eg im_clone after each process. Then, when the result is wrong, you can find which part is wrong.
// 1 add mask :convert before.jpg -fill black -colorize 30% result.jpg