Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

restoring alpha channel after the Heal transparency action #53

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions PluginScripts/plugin-heal-transparency.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

gettext.install("resynthesizer", gimp.locale_directory, unicode=True)

def heal_transparency(timg, tdrawable, samplingRadiusParam=50, orderParam=2):
def heal_transparency(timg, tdrawable, samplingRadiusParam=50, orderParam=2, remove_alpha=1):

# precondition should be enforced by Gimp according to image modes allowed.
if not pdb.gimp_drawable_has_alpha(tdrawable):
Expand Down Expand Up @@ -62,14 +62,18 @@ def heal_transparency(timg, tdrawable, samplingRadiusParam=50, orderParam=2):

# restore selection
pdb.gimp_image_select_item(timg, CHANNEL_OP_REPLACE, org_selection)

# restore alpha
if not remove_alpha :
pdb.gimp_layer_add_alpha(tdrawable)

# Clean up (comment out to debug)
pdb.gimp_image_undo_group_end(timg)


register(
"python_fu_heal_transparency",
N_("Removes alpha channel by synthesis. Fill outward for edges, inward for holes."),
N_("Removes transparency by synthesis. Fill outward for edges, inward for holes."),
"Requires separate resynthesizer plugin.",
"Lloyd Konneker",
"Copyright 2010 Lloyd Konneker",
Expand All @@ -81,7 +85,8 @@ def heal_transparency(timg, tdrawable, samplingRadiusParam=50, orderParam=2):
(PF_DRAWABLE, "drawable", "Input drawable", None),
(PF_INT, "samplingRadiusParam", _("Context sampling width (pixels):"), 50),
(PF_OPTION, "orderParam", _("Filling order:"), 2, [_("Random"),
_("Inwards towards center"), _("Outwards from center") ])
_("Inwards towards center"), _("Outwards from center") ]),
(PF_TOGGLE, "remove_alpha", _("Remove alpha channel:"), 1)
],
[],
heal_transparency,
Expand Down
18 changes: 11 additions & 7 deletions po/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -102,25 +102,29 @@ msgid "Above and below"
msgstr ""

#: ../PluginScripts/plugin-heal-selection.py:169
#: ../PluginScripts/plugin-heal-transparency.py:83
#: ../PluginScripts/plugin-heal-transparency.py:87
msgid "Filling order:"
msgstr ""

#: ../PluginScripts/plugin-heal-selection.py:169
#: ../PluginScripts/plugin-heal-transparency.py:83
#: ../PluginScripts/plugin-heal-transparency.py:87
msgid "Random"
msgstr ""

#: ../PluginScripts/plugin-heal-selection.py:170
#: ../PluginScripts/plugin-heal-transparency.py:84
#: ../PluginScripts/plugin-heal-transparency.py:88
msgid "Inwards towards center"
msgstr ""

#: ../PluginScripts/plugin-heal-selection.py:170
#: ../PluginScripts/plugin-heal-transparency.py:84
#: ../PluginScripts/plugin-heal-transparency.py:88
msgid "Outwards from center"
msgstr ""

#: ../PluginScripts/plugin-heal-transparency.py:89
msgid "Remove alpha channel:"
msgstr ""

#: ../PluginScripts/plugin-resynth-sharpen.py:94
msgid "Sharpen image by synthesis."
msgstr ""
Expand Down Expand Up @@ -217,12 +221,12 @@ msgstr ""
msgid "Brightness only"
msgstr ""

#: ../PluginScripts/plugin-heal-transparency.py:72
#: ../PluginScripts/plugin-heal-transparency.py:76
msgid ""
"Removes alpha channel by synthesis. Fill outward for edges, inward for "
"Removes transparency by synthesis. Fill outward for edges, inward for "
"holes."
msgstr ""

#: ../PluginScripts/plugin-heal-transparency.py:77
#: ../PluginScripts/plugin-heal-transparency.py:81
msgid "Heal transparency..."
msgstr ""
20 changes: 12 additions & 8 deletions po/ru.po
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ msgid "_Heal selection..."
msgstr "_Восстановить выделение…"

#: ../PluginScripts/plugin-heal-selection.py:167
#: ../PluginScripts/plugin-heal-transparency.py:82
#: ../PluginScripts/plugin-heal-transparency.py:86
msgid "Context sampling width (pixels):"
msgstr "Ширина области заимствования (px):"

Expand All @@ -210,25 +210,29 @@ msgid "Above and below"
msgstr "Верх и низ"

#: ../PluginScripts/plugin-heal-selection.py:169
#: ../PluginScripts/plugin-heal-transparency.py:83
#: ../PluginScripts/plugin-heal-transparency.py:87
msgid "Filling order:"
msgstr "Порядок заполнения:"

#: ../PluginScripts/plugin-heal-selection.py:169
#: ../PluginScripts/plugin-heal-transparency.py:83
#: ../PluginScripts/plugin-heal-transparency.py:87
msgid "Random"
msgstr "Случайный"

#: ../PluginScripts/plugin-heal-selection.py:170
#: ../PluginScripts/plugin-heal-transparency.py:84
#: ../PluginScripts/plugin-heal-transparency.py:88
msgid "Inwards towards center"
msgstr "Вовнутрь к центру"

#: ../PluginScripts/plugin-heal-selection.py:170
#: ../PluginScripts/plugin-heal-transparency.py:84
#: ../PluginScripts/plugin-heal-transparency.py:88
msgid "Outwards from center"
msgstr "Наружу от центра"

#: ../PluginScripts/plugin-heal-transparency.py:89
msgid "Remove alpha channel:"
msgstr "Удалить альфа-канал:"

#: ../PluginScripts/plugin-resynth-sharpen.py:94
msgid "Sharpen image by synthesis."
msgstr "Увеличить резкость изображения."
Expand Down Expand Up @@ -332,15 +336,15 @@ msgstr "Цвет и яркость"
msgid "Brightness only"
msgstr "Только яркость"

#: ../PluginScripts/plugin-heal-transparency.py:72
#: ../PluginScripts/plugin-heal-transparency.py:76
msgid ""
"Removes alpha channel by synthesis. Fill outward for edges, inward for "
"Removes transparency by synthesis. Fill outward for edges, inward for "
"holes."
msgstr ""
"Заполнить прозрачную область при помощи синтеза. Заполнение наружу "
"предназначено для краёв, вовнутрь — для дыр."

#: ../PluginScripts/plugin-heal-transparency.py:77
#: ../PluginScripts/plugin-heal-transparency.py:81
msgid "Heal transparency..."
msgstr "Восстановить прозрачную область…"

Expand Down