Last active
March 11, 2022 03:43
-
-
Save AntumDeluge/3410fc02ee88396756e0fa1074c9562c to your computer and use it in GitHub Desktop.
GIMP plugin to convert semitransparent pixels to opaque
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
''' | |
Date: 2020-12-23 | |
Description: | |
A simple GIMP plugin that duplicates & merges down the current | |
layer multiple times in order convert semitransparent pixels to | |
opaque without losing/changing color. | |
Usage: | |
<Menu> Layer -> Transparency -> Semitransparency to Opaque | |
Licensing: | |
The author hereby relinquishes all rights to this work & dedicates | |
it to the Public Domain via Creative Commons Zero (CC0). See: | |
https://creativecommons.org/licenses/publicdomain/ | |
''' | |
from gimpfu import * | |
def semitrans_to_opaque(image, drawable): | |
pdb.gimp_image_undo_group_start(image) | |
for x in range(0, 10): | |
newlayer = drawable.copy() | |
image.add_layer(newlayer) | |
drawable = image.merge_down(newlayer, 0) | |
pdb.gimp_image_undo_group_end(image) | |
register( | |
'python_fu_semitrans_to_opaque', | |
'Semitransparency to Opaque', | |
'Make semitransparent pixels opaque while preserving color.', | |
'Jordan Irwin (AntumDeluge)', '', '2020', | |
'<Image>/Layer/Transparency/Semitransparency to Opaque', | |
'*', | |
[], | |
[], | |
semitrans_to_opaque | |
) | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment