It is currently 06 May 2021, 12:18

• Featuring Members' Works (Image Attachments) •
1: member
2: member
3: member
4: member
5: member

GIMP/GL:  Tutorials | Tips | Questions | Interests | Script Requests
Recommendations:  Index | Top 10
Resources:  🡆 Python-Fu Plug-ins | Scheme-Fu Scripts | GIMP
Python:  Lessons | Questions | Exercises
The Arts:  GIMPed | GIMPed Photos | Other | Contests | Public Domain Images | Isolated Images | Blender
Inkscape
Social:  Say Hello | Anything Goes | Shares | FCSP

Mask-If Plug-in (A Photoshop's BLEND-IF Substitute)

Share your Python Fu Scripts/plug-ins for GIMP here
tim
GL Blogger

Mask-If Plug-in (A Photoshop's BLEND-IF Substitute)

Post#1 by tim » 26 Feb 2021, 14:23


Asked for Photoshop BLEND-IF plug-in by n3306tx.
I watched a youtube video on Photoshop Blend-If tutorial.
From what I learned from tutorial is that you can select a low value (which can break into 2 points for soft transitions)
and a high value (which can also break into 2 points for soft transitions)
So I have allowed 4 points in total (Low Minimum & Low Maximum for 2 point soft transition for low point and
High Minimum & High Maximum for point soft transition for high point).
The plug-in is called Mask-If.
Instructions:
  1. Select the layer you'd like apply mask-if to
  2. Run Plug-in, select channel, select 4-point numbers from 0-255 (that you'd like to use like in Photoshop Blend-If)
  3. Click OK
  4. Plug-in will create a layer called/named "Mask-if" for you to play with afterwards (but it'll be set to not visible because it will already apply that mask to your selected layer).
mask-if.py #
(3.99 KiB) Downloaded 33 times
mask-if.py #
Spinner value bug fix.
Spinner value adjustment bug fix. Previous version wouldn't allow spinner values to be incremented/decremented but had to manually enter text/numeric values
(3.99 KiB) Downloaded 21 times
mask-if.py #
Version 3. Fast version (compared to version 1 & 2)
(5.44 KiB) Downloaded 25 times
mask-if.py #
Version 4: Preprocess 0-255 values to reduce overhead processing
(5.34 KiB) Downloaded 24 times
mask-if.py #
Version 5: Slight speed enhancement
(7.67 KiB) Downloaded 20 times
mask-if.py #
Version 6: Even more speed enhancement
(7.9 KiB) Downloaded 23 times
mask-if.py #
Version 7: Undo (Ctrl+Z) in one step (so that user can easily undo and try another setting)
(7.99 KiB) Downloaded 22 times
mask-if.py #
Version 8: less progress updates runs even faster (about 3 seconds for 800px x 800px layer)
(8.2 KiB) Downloaded 25 times
mask-if.py #
Version 9: Remove unneeded casting for more speed (1600px x 1600px now takes about 9 seconds; 800px x 800px now takes under 2 seconds)
(8.32 KiB) Downloaded 53 times
Plug-in Menu Location: Python-Fu/A Mask-If
PS-BLEND-IF-substitute-in-GIMP-mask-if-screenshot-options.jpg
PS-BLEND-IF-substitute-in-GIMP-mask-if-screenshot-options.jpg # (34.31 KiB) Viewed 913 times (Thumbnail | Recognize | Sq Tile)
PS-BLEND-IF-substitute-in-GIMP-mask-if-screenshot1.jpg
PS-BLEND-IF-substitute-in-GIMP-mask-if-screenshot1.jpg # (17.54 KiB) Viewed 913 times (Thumbnail | Recognize | Sq Tile)
PS-BLEND-IF-substitute-in-GIMP-mask-if-screenshot2.jpg
PS-BLEND-IF-substitute-in-GIMP-mask-if-screenshot2.jpg # (24.42 KiB) Viewed 913 times (Thumbnail | Recognize | Sq Tile)
aka Tin

         

tim
GL Blogger

Post#2 by tim » 26 Feb 2021, 18:35


This plug-in could possibly be known as "Smooth Transition Threshold" as it's similar to threshold in that in converts a range of values to white and outside that range to black but also allows for smooth transition.
aka Tin

         

tim
GL Blogger

Post#3 by tim » 26 Feb 2021, 19:29


Speed is a pain right now.
Looks like I could use the pixels access logics from http://gimpchat.com/viewtopic.php?f=9&t=10516#p138722
to speed things up...will update when when I have something.
aka Tin

         

tim
GL Blogger

Post#4 by tim » 26 Feb 2021, 21:17


UPDATED with version 3 for super speed enhancement.
See code for get_pixel/set_pixel/put_pixel methods using set_pixel_rgn. Very speedy enhancement.
if anyone is looking for set_pixel_rgn then the code in this plug-in allows shows how to set the pixel_rgn since there is no such method.
aka Tin

         

tim
GL Blogger

Post#5 by tim » 27 Feb 2021, 13:47


UPDATED version 7: for super speed and Ctrl+Z (Undo) in one step so users can easily rerun with different settings.
aka Tin

         

tim
GL Blogger

Post#6 by tim » 27 Feb 2021, 22:18


Fast pixel access code found and worked with from: https://shallowsky.com/software/arclayer/
aka Tin

         

tim
GL Blogger

Post#7 by tim » 28 Feb 2021, 12:29


Great, now if you google search for "blend-if gimp plug-in", this topic is shown 2nd place so hopefully many will find it easily and find it useful, we'll convert everyone from PS to GIMP users LOL
aka Tin

         


GIMP/GL:  Tutorials | Tips | Questions | Interests | Script Requests
Recommendations:  Index | Top 10
Resources:  🡆 Python-Fu Plug-ins | Scheme-Fu Scripts | GIMP
Python:  Lessons | Questions | Exercises
The Arts:  GIMPed | GIMPed Photos | Other | Contests | Public Domain Images | Isolated Images | Blender
Inkscape
Social:  Say Hello | Anything Goes | Shares | FCSP

Post Reply New Topic
  • Similar Topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 17 guests