Page 2 of 2

Re: Extract Clipping Image

Posted: 2020-03-24T01:08:29-07:00
by snibgo
ckunchala wrote:is it possible to combine both commands into single command?
Yes, you can put all those options in a single command.

ckunchala wrote:Any specific reason to keep result in PNG ?
You didn't say what output file you wanted, so I used PNG as an example. The image is flattened so has no transparency, so JPG could be used. But JPG is only 8 bits/channel/pixel, and is lossy-compressed, so I suggest you never use it unless you really have to, and certainly NOT as an intermediate file that will be further processed.

Re: Extract Clipping Image

Posted: 2020-03-25T23:40:59-07:00
by ckunchala
yeah understood, and thank you so much for your help. :)

Re: Extract Clipping Image

Posted: 2020-04-16T05:54:58-07:00
by ckunchala
Hi Experts,

one more question on this topic, is it possible to outline with the some color through out the edges of clipping image.

for example, if you see the image at http://img.buzzram.de/uploads/158704148 ... 7_at_11.27 , we can see the outline with blue color across the edges of clipping image.

Thanks million.

Best,
Chandra

Re: Extract Clipping Image

Posted: 2020-04-16T06:31:26-07:00
by snibgo
We can turn all fully-transparent pixels into transparent red. Then we extract the alpha channel, dilate the white areas, and copy the opacity back to the image. The result has a red outline. Windows BAT script:

Code: Select all

magick ^
  1584707760age.jpg ^
  -profile sRGB.icc ^
  -alpha transparent ^
  -clip -alpha opaque +clip ^
  -background Red -alpha background ^
  ( +clone ^
    -alpha extract ^
    -morphology dilate disk:5 ^
  ) ^
  -alpha off ^
  -compose CopyOpacity -composite ^
  out.png