Mobile app version of vmapp.org
Login or Join
Cofer715

: Script for GIMP to make a certain area transparent for several images I would like to have a script to process a set of image files in png format, lets's say inside of one directory. We

@Cofer715

Posted in: #Automation #Gimp #Script

I would like to have a script to process a set of image files in png format, lets's say inside of one directory. We can also assume the images have the same size. The processing should contain of the following actions: select certain region, make it transparent, repeat for the next file.

Just an example to illustrate what I mean:



should be turned into



And



into



edit: @Paolo Gibbelini and @Scribblemacher , you made good suggestions. However I need now to slightly change my requirements. The width of the input image may be different and with of the crop area should be equal to the image width. The height of the crop area should be constantly 69 pixels. Can I achieve that with ImageMagick as well? Would it be correct to pass geometry like 9999x9999+0+69 for the crop?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Cofer715

1 Comments

Sorted by latest first Latest Oldest Best

 

@Steve758

This kind of operation could be simply performed with Imagemacick using crop function.

In your example:

convert your_image.png -crop 423x275+0+113 -background transparent -flatten cropped_image.png


The output is:



Using a batch file you can process all your images.

Edit

convert works even using in the geometry dimensions greater than the dimensions of the image itself:

convert your_image.png -crop 9999x9999+0+69 -background transparent -flatten cropped_image.png




Fore more complex operations you can get the attributes of the image using the identify command in your batch file.

As evidenced by @Scribblemacher , you can use mogrify in order to simplify the batch operation. Be aware that mogrify overwrites original files.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme