Here is the path "M276,189h268c5.5,0,10,4.5,10,10v196c0,5.5-4.5,10-10,10H276 c-5.5,0-10-4.5-10-10V199C266,193.5,270.5,189,276,189z"
This is the input image:
After applying the path to the image by using the below code
draw = Magick::Draw.new
draw.fill 'red'
draw.path path
draw.clip_rule("evenodd")
draw.fill_rule("evenodd")
draw.fill_opacity(0)
draw.draw image
img.trim!
img.write('output.jpg')
This is the output image:
Now I want to cut the red color part of the image. This means expecting the brown color part only visible. I used the normal image-level crop method. with this Am able to extract the red color part only But I want to extract the image other than the red color from the output image.
Here is the sample output for the black image sample output for the black color
Maybe we have to reverse clip or reverse crop to get this ...