Skip to content

Instantly share code, notes, and snippets.

@AntumDeluge
Last active March 11, 2022 03:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AntumDeluge/3410fc02ee88396756e0fa1074c9562c to your computer and use it in GitHub Desktop.
Save AntumDeluge/3410fc02ee88396756e0fa1074c9562c to your computer and use it in GitHub Desktop.
GIMP plugin to convert semitransparent pixels to opaque
#!/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