It is currently 19 Jan 2020, 05:46


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

Mass defringe plug-in

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

Mass defringe plug-in

Post#1 by tim » 04 Dec 2019, 14:21


Here's the mass-defringe plug-in.
Allows user to select input directory (directory with png's) and output directory which it'll process and output to with same filenames as originals.
mass-defringe.py
(3.24 KiB) Downloaded 13 times
mass-defringe.py
version 2. see animation created by this version
(3.67 KiB) Downloaded 13 times
mass-defringe.py
version 3. Make os external call to ImageMagick (convert) to call simply function that acts like colortoalpha.
(4.56 KiB) Downloaded 12 times
mass-defringe.py
version 4. Calls imagemagick with gain 1.7 and use Threshold-alpha instead of merging downs.
(4.98 KiB) Downloaded 11 times
mass-defringe.py
version 5. Ignore/Doesn't perform color2alpha step.
(5.04 KiB) Downloaded 18 times
mass-defringe.py
version 6. threshold with setting similar to 0.5 (127)
(5.04 KiB) Downloaded 21 times
Plug-in Menu Location:Python-fu/Mass Defringe

Instructions:
1. run plug-in.
2. select input directory, output directory, and click OK to run. That's it.

This plug-in was to fulfill this request: viewtopic.php?f=18&t=2594
Steps described here: viewtopic.php?p=29734#p29734 (Color to alpha using color at location [1,1] and fuzzy select using location [1,1])
Defringe script (required) found here: viewtopic.php?p=29708#p29708
created with version 2 of plug-in. Used color select with threshold of 48 and cleared instead of color to alpha.
created with version 2 of plug-in. Used color select with threshold of 48 and cleared instead of color to alpha.
monkey.gif (58.16 KiB) Viewed 406 times
aka Tin
:tree_02:
Tin's: Favorite Index | Simple Art === fb4yt video search | fb4yt recent video views report
Lottery numbers from image | Interested Members in TLF
Paying for hosting is to support my hobby, and donating money made from ads to The Red Cross.
         
1

hemersonkl
Forum Member

Post#2 by hemersonkl » 04 Dec 2019, 17:28


Image Hi. Very very cool. This is much faster. But. = / Output looks like this. With blue parts. Strange because when I use Color to alpha these defects always disappear. https://imgur.com/qy3oOHG
GIMP Learn rocks...
0

tim
GL Blogger

Post#3 by tim » 04 Dec 2019, 17:38


hemersonkl wrote:
04 Dec 2019, 17:28
Image Hi. Very very cool. This is much faster. But. = / Output looks like this. With blue parts. Strange because when I use Color to alpha these defects always disappear. https://imgur.com/qy3oOHG
Not sure what that is I just specify color at location (1,1) and use that to call color to alpha.
Can you upload a zip of 10 of your sample images...I'll see if color select and delete does a better job or not.
aka Tin
:tree_02:
Tin's: Favorite Index | Simple Art === fb4yt video search | fb4yt recent video views report
Lottery numbers from image | Interested Members in TLF
Paying for hosting is to support my hobby, and donating money made from ads to The Red Cross.
         
1

hemersonkl
Forum Member

Post#4 by hemersonkl » 04 Dec 2019, 17:43


GIMP Learn rocks...
0

tim
GL Blogger

Post#5 by tim » 04 Dec 2019, 17:59


I have problem downloading that file.
in any case I need to be able to call colortoalpha with a threshold and there isn't a way to do that (that I can see).
I have to consult some help.
aka Tin
:tree_02:
Tin's: Favorite Index | Simple Art === fb4yt video search | fb4yt recent video views report
Lottery numbers from image | Interested Members in TLF
Paying for hosting is to support my hobby, and donating money made from ads to The Red Cross.
         
1

hemersonkl
Forum Member

Post#6 by hemersonkl » 04 Dec 2019, 18:06


GIMP Learn rocks...
0

Krikor
Forum Member

Post#7 by Krikor » 04 Dec 2019, 18:54


The lower the opacity Threshold the greater the residual presence of blue (color for chosen alpha).
The higher the opacity Threshold, the more opaque the image will be, as this tone will also be removed from the image.

In this image, the default Color to Alpha generates an unclean result with a 'blue dust' around the final object.
Krikor - Color to alpha defringe
Krikor - Color to alpha defringe
003-0255B.png (25.09 KiB) Viewed 417 times
"I feel that in both art and music, it's not the success that matters but the pleasure it gives you. Focus on the pleasure and the learning will come naturally." - Brian Weston
2

hemersonkl
Forum Member

Post#8 by hemersonkl » 04 Dec 2019, 20:16


Krikor wrote:
04 Dec 2019, 18:54
The lower the opacity Threshold the greater the residual presence of blue (color for chosen alpha).
The higher the opacity Threshold, the more opaque the image will be, as this tone will also be removed from the image.

In this image, the default Color to Alpha generates an unclean result with a 'blue dust' around the final object.
003-0255B.png
yes but, using the normal color to alpha option it totally disappears.
GIMP Learn rocks...
0

Krikor
Forum Member

Post#9 by Krikor » 04 Dec 2019, 20:24


hemersonkl wrote:
04 Dec 2019, 20:16
Krikor wrote:
04 Dec 2019, 18:54
The lower the opacity Threshold the greater the residual presence of blue (color for chosen alpha).
The higher the opacity Threshold, the more opaque the image will be, as this tone will also be removed from the image.

In this image, the default Color to Alpha generates an unclean result with a 'blue dust' around the final object.
003-0255B.png
yes but, using the normal color to alpha option it totally disappears.
@hemersonkl,
Yes, it almost disappears.
Removing the blue dust, it leaves a blue outline outlining the image (left figure).
But you can automate the final cleanup with selection, grow, and delete selection. (Figure at right)
Krikor - ColorToAlpha playing
Krikor - ColorToAlpha playing
003-0255C.png (30.12 KiB) Viewed 411 times
"I feel that in both art and music, it's not the success that matters but the pleasure it gives you. Focus on the pleasure and the learning will come naturally." - Brian Weston
1

tim
GL Blogger

Post#10 by tim » 04 Dec 2019, 20:49


Please try version 2 of plug-in in post #1.
This what version 2 was able to produce. Instead of color to alpha which is apparently a mess (different) from front end and back end, I used color select with threshold of 48/255 and cleared selection.
which left some blueish outline but then defringe seem to have taken care of that (I guess this is what defringe does, it transforms blueish pixels around image into correct color [at least it looks correct to me]).
Image

Thank you @Krikor for the effort of explaining this weirdness with color-to-alpha.
Looking at the animation, I believe we have something usuable (version 2).
Hooray, monkey galore, here we come :fb_haha:

The problem was color-to-alpha (front end) you can change transparency threshold to create a clean image. But back end code has no way of calling it with transparency threshold (you can only specify color). So I played around and discovered that I can just use color select with the right threshold to clear the blue what's left (partially blue pixels around the dark pixels of image) is handled by defringe process.
aka Tin
:tree_02:
Tin's: Favorite Index | Simple Art === fb4yt video search | fb4yt recent video views report
Lottery numbers from image | Interested Members in TLF
Paying for hosting is to support my hobby, and donating money made from ads to The Red Cross.
         
1


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
  • Similar Topics
    Replies
    Views
    Last post
• Featuring Members' Works (Image Attachments) •
1: member
2: member
3: member
4: member
5: member

Who is online

Users browsing this forum: No registered users and 6 guests