before:

after:

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 100snibgo wrote: 2018-11-28T06:08:25-07:00By 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?
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.
sorry ,i copy the small size img. i have upload the full size img. where is the problem with my code ?
// 1 add mask :convert before.jpg -fill black -colorize 30% result.jpgsnibgo wrote: 2018-11-28T11:13:47-07:00 "-alpha off" deactivates the alpha channel, so CopyOpacity will copy from the intensity, not from the alpha channel. By contrast, setting alpha to opaque activates the alpha channel, setting all pixels opaque, and that's not what you want.
Hello, if the original picture is a PNG transparent picture, how can I dig it out and Keep the original transparency?