“Open file as mask” python script for Ver. 2.10

I wrote a simple Python script for GIMP 2.10. You can open a file as mask. Copy this to GIMP’s plugins directory and it will appear in the GIMP menu as shown below.

Select the layer you want to add a mask to, open a grayscale or black and white image with this script, and easily load the file as a mask.


Thanks for this. I just installed it and tested out that it was working. I was able to open a color image and it was turned into a greyscale mask. I am not sure how I will use your script yet. Can I ask what motivated you to make it or more specifically what it will be used for by you. This will help me appreciate what I can do with it.

My motivation to write this script is using images processed with other applications (like ImageMagick, Python with opencv, darktable, RawTherapee etc…) as mask of GIMP. I mainly use ImageJ for this purpose. I don’t know how many people are interested in ImageJ on this forum, which is thought in general as FOSS for bio-scientific analysis. However, IMO, it has powerful image calculation functions that make it also very useful for general photo image processing.

Interesting. I teach image J at a university for image analysis from microscopes. I had never thought about using it for normal photos.

At least writing Python script for ImageJ is much easier than for GIMP. Besides, the GIMP Python-fu specification is in flux. Writing way of Python script will be drastically changed in GIMP Ver. 3, and nonetheless there are no instructions for that yet. Therefor I think I have to write ImageJ script for GIMP image editing.

In link below, Here is an example of ImageJ script for editing in GIMP.

It is a making tool of spot removal mask.

If you are interested in ImageJ script for photo editing, please try it.