I want to replace the current image opened in GIMP by another image using a Gimp-Python plugin. I was thinking of closing the first image and then opening the other but I don't know how to access the current image.
I was also stuck with a problem when i tried doing that. I have to call the plugin from a python file and when I try to run it multiple times in a row it only run the first time. Here is my code:
loadImage.py
#!/usr/bin/env python
from gimpfu import *
def loadImage(file):
image = pdb.gimp_file_load(file, file)
gimp.Display(image)
gimp.displays_flush
args = [(PF_STRING, 'file', 'GlobPattern', '*.*')]
register('loadImage',
'Load an image',
'Load an image',
'Name',
'Company',
'2015',
'',
'',
args,
[],
loadImage)
main()
main.py
from subprocess import *
cmd = '(loadImage RUN-NONINTERACTIVE "/home/user/image.jpg")'
#check_output(['/usr/bin/gimp', '-b', cmd])
call(['/usr/bin/gimp', '-b', cmd])
This code just open an image in GIMP but I expect that it would open multiple images when I run it multiple times but it only open an image the first time. I tried with check_output() and with call() but it was the same result. I suppose it has to be with the batch mode but I'm not sure because i tried
call(['/usr/bin/gimp', '-b', cmd, '-b', cmd])
and it would open two images.
What am I doing wrong? And is there a way access to the current image?
Aucun commentaire:
Enregistrer un commentaire