I'm trying to get to grips with image manipulation using GIMP and I'm failing at the first hurdle:
With an image loaded in GIMP, I want to run a registered script to run a function - simply rotate the whole image by 90 degrees and then display a message.
#!/usr/bin/env python
import os
import sys
import time
from gimpfu import *
def simple_test():
num = 90
image = gimp.pdb # not sure if this is calling the active image
drawable = pdb.gimp_image_get_active_layer(image)
rotate_it(image, 90)
def rotate_it(image, deg):
msg = "simple_test!! " + str(deg) + "\n"
pdb.gimp_image_rotate(gimp.pdb, num)
gimp.message(msg)
register(
"simple_test",
"A simple Python-Fu plug-in",
"When run this plug-in rotates an image 90 degrees",
"Ghoul Fool",
"Ghoul Fool",
"2020",
"simple test",
"",
[],
[],
simple_test,
menu="<Image>/Filters/simple-test",
)
main()
More importantly is trying to get some error message/log/console output to find out where I'm going wrong - only that doesn't seem to display by default.
it definitely looks like you are calling the current image wrongly. Perhaps this example script can help you out:
I would also suggest this guy's video series about gimp python fu: https://www.youtube.com/watch?v=nmb-0KcgXzI. Unfortunately, the official documentation (in my opinion) lacks beginner friendliness considering the debugging.