I'm a newbie in python-fu, (my second day), so my question may seem naive: I'd like to select a rectangular portion from "r400r.png", rotate it 90 degrees, and save my selection in "r400ra.png".
So far, I tried something on these lines:
for fv in range(400,401):
fn='r%sr.png' % fv
img=pdb.gimp_file_load('/path/'+fn,fn)
drw=pdb.gimp_image_get_active_layer(img)
img1=pdb.gimp_image_new(1024,1568,0)
lyr=pdb.gimp_layer_new(img1,1024,1568,0,'ly1',0,0)
pdb.gimp_rect_select(img,10,200,1422,1024,2,0,0)
drw=pdb.gimp_rotate(drw,0,1.570796327)
pdb.script_fu_selection_to_image(img1,drw)
f0=fn[:5]+'a'+fn[5:]
pdb.gimp_file_save(drw,'/path/'+f0,f0)
The "lyr" layer is there because my understanding is that it is a must, although it's not clear to me why. The "for" loop eventually should bulk process a bunch of files; for testing it is restricted to one file only. I get an error where I try o execute "script_fu_selection_to_image".
Can you point me, please, in the right direction?
Thanks, SxN
The PDB calls to do that are better in this order: