Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bash: Fill color on specific part of image

Tags:

linux

bash

I am looking for a way to batch process images in bash.

Is there any way to fill up specific part of image?

Example:

enter image description here

I want to fill up the red part with white color. The red part is always on the top left corner, size is 135x35px.

Yes, Gimp/Photoshop is one way to do this, but I have lot of images and I love automatize things with bash.

like image 655
Adrian Avatar asked Oct 15 '25 00:10

Adrian


1 Answers

Sure, use ImageMagick - installed on most Linux distros and available for OSX and Windows.

convert input.png -fill white -draw "rectangle 0,0 135,35" result.png

If you have many files, make a COPY in a spare folder and try this and it will probably do them all

mogrify -fill white -draw "rectangle 0,0 135,35" *.jpg
like image 131
Mark Setchell Avatar answered Oct 17 '25 14:10

Mark Setchell