Page 1 of 1

Removing Pixels from Background Image Based On Custom Object

Posted: 2018-11-27T09:19:56-07:00
by travelgravel
I have gone through the examples and also searched the forums, but have been unable to find a solution to a problem I am trying to handle.

I would like to be able to upload an image, in this example, a picture of my father. I would then make a custom oval object. I would like to be able to move this custom object to where it frames my fathers face in the image and then perform a clipping of the uploaded image. This would remove all pixels outside of my oval object on the uploaded image. I have been able to get an image uploaded and also created an oval object, but am unsure if this clipping that I want is possible. Any ideas?

Thanks for taking a look at my problem. Cheers!

Re: Removing Pixels from Background Image Based On Custom Object

Posted: 2018-11-27T09:31:26-07:00
by snibgo
What version of IM? On what platform?

This seems simple, for example, assuming oval.png has a white oval on black background:

Code: Select all

magick father.png oval.png -alpha off -compose CopyOpacity -composite -trim +repage out.png
Does that help? If not, please post links to sample images.

Re: Removing Pixels from Background Image Based On Custom Object

Posted: 2018-11-27T09:47:00-07:00
by fmw42
Please, always provide your IM version and platform when asking questions, since syntax may differ.

Also provide your exact command line and your images, if possible.

See the top-most post in this forum "IMPORTANT: Please Read This FIRST Before Posting" at http://www.imagemagick.org/discourse-se ... f=1&t=9620

If using Imagemagick 7, then see http://imagemagick.org/script/porting.php#cli


For novices, see

http://www.imagemagick.org/discourse-se ... f=1&t=9620
http://www.imagemagick.org/script/comma ... essing.php
http://www.imagemagick.org/Usage/reference.html
http://www.imagemagick.org/Usage/
https://github.com/ImageMagick/usage-markdown
https://imagemagick.org/script/porting.php#cli