script-fu-simple-contrast-mask adds a contrast mask layer above the current active layer. A contrast mask brightens the dark parts of an image and darkens the bright parts. This serves to enhance details.
The script is called "simple" because it does not ask any questions. It assumes defaults for all parameters. Specifically, the radius for the Gaussian blur is set to one percent of the shortest dimension of the image (width or height). The user can adjust the blending level after creation by adjusting the opacity in the layers dialog.
To use the script, copy the script-fu-simple-contrast-mask.scm file into the scripts folder under the .gimp-2.6 folder in your home folder. Then click on the Filters menu in the GIMP's main window, go down to the Script-Fu item, and select "Refresh Scripts". You should find "Simple Contrast Mask" at the bottom of the Colors menu.
| Attachment | Size |
|---|---|
| script-fu-simple-contrast-mask.scm | 3.08 KB |
Comments
I'm repeating this comment to
I'm repeating this comment to make it more visible. I added Rob A's changes to the script and uploaded a second version. Hopefully this one will behave more robustly. Thank you Rob A for pointing out the source of the problem and the solution.
This was my first script-fu script. Encouraging to see that some folks at least gave it a try.
Some problems
Hi an interesting script, would help for quick fixes. But ---
When I have a second picture open, the script performs again on Picture 1 and opens there a third layer.
Problems with the script
Hi-
I haven't run the script but there are a number of calls in the script that use the value "1" rather than the "image" parameter.
For example:
(active-layer (car (gimp-image-get-active-drawable 1)))
should be:
(active-layer (car (gimp-image-get-active-drawable image)))
same with:
(gimp-image-add-layer 1 contrast-mask -1)
and I think (thought I don't have gimp handy to check the parameters in the pdb)
(plug-in-gauss-iir 1 1 contrast-mask blur-radius 1 1)
-Rob A>
I made the changes Rob A
I made the changes Rob A recommended and uploaded the new version. It's the second one in the list. (Anyone tell me how to delete an attachment?) Thanks for the help Rob! Sorry to take so long to get this fixed. This was literally my first script-fu script and I literally have not gotten back to using the camera for which I developed the script until now.
Andrew
Nevermind. The next time I
Nevermind. The next time I clicked the edit button, I found the delete box.
You can also
You can also just toggle the script to hide from the list. This is a good idea if you have to revert back to an older script for information and research, etc.
Problems with the script
Rob, I had the same problem running this script and arrived at the same conclusion you did. But I'm curious why some (spoilt_exile, for example) have said they have no trouble running the script. I'm on a nearly identical platform (Linux 2.6.32) as he reports-- so I am feeling just a bit confounded by the differing result.
Just lucky
If you are lucky (or just starting gimp) your first image WILL be 1, so the script will work.
-Rob A>
In addition...
To be a little more particular, the first image opened will be "1" if no previews are generated in the File->Open dialog (while opening). When producing these previews, GIMP temporarily creates images; incrementing the actual image ID that gets assigned to the eventually opened image.
Nonetheless, the point still remains that scripts should never employ hard-coded image IDs.