1

I have a png image. How can I cut a small rect from this image using imagemagick? (make a transparent hole in image)

For example:

Source:

Source

Destination:

Destination

Rodion
  • 521
  • 2
  • 10

1 Answers1

3

It seems I figure it out.

convert u1.png -alpha set -region 40x30+15+5 -alpha transparent u3.png

It cuts a rect (40x30) from u1.png

Rodion
  • 521
  • 2
  • 10
  • I believe the `-alpha set` is unnecessary. – René Nyffenegger Feb 15 '16 at 20:05
  • Without -alpha set, the second image is completely transparent – jessi Sep 22 '18 at 20:59
  • @Rodion unfortunately, I don't get this to work with ImageMagick7.1 Error: "wrong" parameter `-alpha`. But here is a (longer) solution (in the comments) which seems to work: https://stackoverflow.com/a/64823099/7295599 – theozh Jul 31 '22 at 09:11