From 7473c9eb1ff646412df7d45c03941e9352239261 Mon Sep 17 00:00:00 2001 From: Darek Janik Date: Mon, 11 Jun 2018 23:09:31 +0200 Subject: [PATCH 1/2] restored alpha channel after the heal transparency action --- PluginScripts/plugin-heal-transparency.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/PluginScripts/plugin-heal-transparency.py b/PluginScripts/plugin-heal-transparency.py index 31799fc..de539a7 100644 --- a/PluginScripts/plugin-heal-transparency.py +++ b/PluginScripts/plugin-heal-transparency.py @@ -62,6 +62,9 @@ def heal_transparency(timg, tdrawable, samplingRadiusParam=50, orderParam=2): # restore selection pdb.gimp_image_select_item(timg, CHANNEL_OP_REPLACE, org_selection) + + # restore alpha + pdb.gimp_layer_add_alpha(tdrawable) # Clean up (comment out to debug) pdb.gimp_image_undo_group_end(timg) From 10d3c6e05fc69239f941f2bce7b41ad7c7f83449 Mon Sep 17 00:00:00 2001 From: Darek Janik Date: Wed, 13 Jun 2018 01:56:51 +0200 Subject: [PATCH 2/2] added checkbox to restore alpha channel --- PluginScripts/plugin-heal-transparency.py | 10 ++++++---- po/es.po | 18 +++++++++++------- po/ru.po | 20 ++++++++++++-------- 3 files changed, 29 insertions(+), 19 deletions(-) diff --git a/PluginScripts/plugin-heal-transparency.py b/PluginScripts/plugin-heal-transparency.py index de539a7..ea9ab7f 100644 --- a/PluginScripts/plugin-heal-transparency.py +++ b/PluginScripts/plugin-heal-transparency.py @@ -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): @@ -64,7 +64,8 @@ def heal_transparency(timg, tdrawable, samplingRadiusParam=50, orderParam=2): pdb.gimp_image_select_item(timg, CHANNEL_OP_REPLACE, org_selection) # restore alpha - pdb.gimp_layer_add_alpha(tdrawable) + if not remove_alpha : + pdb.gimp_layer_add_alpha(tdrawable) # Clean up (comment out to debug) pdb.gimp_image_undo_group_end(timg) @@ -72,7 +73,7 @@ def heal_transparency(timg, tdrawable, samplingRadiusParam=50, orderParam=2): 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", @@ -84,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, diff --git a/po/es.po b/po/es.po index 3a5176f..31118f7 100644 --- a/po/es.po +++ b/po/es.po @@ -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 "" @@ -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 "" diff --git a/po/ru.po b/po/ru.po index f5c659e..3cb0397 100644 --- a/po/ru.po +++ b/po/ru.po @@ -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):" @@ -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 "Увеличить резкость изображения." @@ -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 "Восстановить прозрачную область…"