/usr/lib/gimp/2.0/plug-ins/palette-offset.py is in gimp 2.8.16-1ubuntu1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from gimpfu import *
gettext.install("gimp20-python", gimp.locale_directory, unicode=True)
def palette_offset(palette, amount):
#If palette is read only, work on a copy:
editable = pdb.gimp_palette_is_editable(palette)
if not editable:palette = pdb.gimp_palette_duplicate (palette)
num_colors = pdb.gimp_palette_get_info (palette)
tmp_entry_array = []
for i in xrange (num_colors):
tmp_entry_array.append ((pdb.gimp_palette_entry_get_name (palette, i),
pdb.gimp_palette_entry_get_color (palette, i)))
for i in xrange (num_colors):
target_index = i + amount
if target_index >= num_colors:
target_index -= num_colors
elif target_index < 0:
target_index += num_colors
pdb.gimp_palette_entry_set_name (palette, target_index, tmp_entry_array[i][0])
pdb.gimp_palette_entry_set_color (palette, target_index, tmp_entry_array[i][1])
return palette
register(
"python-fu-palette-offset",
N_("Offset the colors in a palette"),
"palette_offset (palette, amount) -> modified_palette",
"Joao S. O. Bueno Calligaris, Carol Spears",
"(c) Joao S. O. Bueno Calligaris",
"2004, 2006",
N_("_Offset Palette..."),
"",
[
(PF_PALETTE, "palette", _("Palette"), ""),
(PF_INT, "amount", _("Off_set"), 1),
],
[(PF_PALETTE, "new-palette", "Result")],
palette_offset,
menu="<Palettes>",
domain=("gimp20-python", gimp.locale_directory)
)
main ()
|