Śledziłem this samouczek i to, co mam wymyślić do tej pory:Gimp: skrypt Pythona nie pokazuje w menu
#!/usr/bin/python
# -*- coding: utf-8 -*-
#http://www.ibm.com/developerworks/library/os-autogimp/
from gimpfu import*
def plugin_main(timg, tdrawable, maxh=540, maxw=800):
currentWidth = tdrawable.width
currentHeight = tdrawable.height
newWidth = currentWidth
newHeight = currentHeight
if (maxw < newWidth):
newWidth = maxw
newHeight = (float(currentHeight)/(float(currentWidth)/newWidth))
if (maxh < newHeight):
newHeight = maxh
newWidth = (float(currentWidth)/(float(currentHeight)/newHeight))
pdb.gimp_image_scale(timg, newWidth, newHeight)
register(
"python_fu_resize",
"Saves the image at a maximum width and height",
"Saves the image at a maximum width and height",
"N N",
"N N",
"2013",
"<Image>/Image/Resize to max...",
"*",
[],
[],
plugin_main)
main()
Ale wtyczki woun't pokazać się w menu gimp (używam GIMP 2.8). Dano plik chmod a + x uprawnienia. Być może lokalizacja pliku stanowi problem: /.gimp-2.8/plug-ins/src/resize.py? Src jest z powodu zaćmienia.
Wprowadzono kilka zmian: dodano brakujące miejsce i przeniesiono skrypt do '/ usr/lib/gimp/2.0/plug-ins'. Teraz pojawia się w menu. Dzięki. – kyng
Kolejna wskazówka do debugowania: uruchom gimp z wiersza poleceń i zobacz, jakie komunikaty o błędach się pojawiają. – kyng
Upewnij się, że skrypt jest wykonywalny. Uruchomienie '$ chmod + x plugin.py' rozwiązało problem. – arunkumar