Page 1 of 1

[SOLVED] transparent overlay minus a rectangle?

Posted: 2013-04-30T03:12:39-07:00
by teracow
Hi all, 8)

I'm hoping someone can help me here.

I have a .jpg that I'd like to overlay with a semi-transparent color (yellow) over the whole image - EXCEPT for a small rectangle (of 60 x 120 pixels) near the top right corner of this image that would NOT have the semi-transparent overlay. Thus, the .jpg as seen through this rectangle would appear without the overlay.

I think that this might involve creating a mask (?) but I'm unsure how to code the command-line for this operation.

OS's that I can test this on are Linux 8) & Windows :(

Any advice would be welcome.

Thanks.

Re: transparent overlay minus a rectangle?

Posted: 2013-04-30T03:53:47-07:00
by snibgo
There are many methods, and this probably isn't the best. Windows script:

Code: Select all

convert ^
  input.jpg ^
  ( +clone -fill rgba(100%%,100%%,0,0.5) -colorize 100 ) ^
  ( +clone -fill White -colorize 100 -fill Black -draw "rectangle 400,50,520,170" ) ^
  -composite x.png
"rgba(100%%,100%%,0,0.5)" is semi-transparent yellow.

Re: transparent overlay minus a rectangle?

Posted: 2013-05-01T00:50:39-07:00
by teracow
thank you, that's exactly what I wanted! :D