Post Reply 

Referencing multiple images open in Gimp

Jun 4, 2012, 10:44 (This post was last modified: Jun 4, 2012 11:00 by bippered.)
Post: #1
Referencing multiple images open in Gimp
Hello,

I have written a couple of *python* scripts which operate on images which are already open. They resize, and save images (including thumbnails) and append simple html code to a file when I press a hotkey.

I want to be able to batch process all open images, without having to save them first or use the Gimp batch processor. Is it possible to do this ? - I have read that it may not be possible to reference specific individual open files, but can I make a simple loop for the already open images using some form of : image = gimp.image_list()[0].

I know this is simple, but I want to know if it is possible before I attempt it Smile

Thanks.
Find all posts by this user
Quote this message in a reply
Jun 4, 2012, 12:37 (This post was last modified: Jun 4, 2012 12:38 by ofnuts.)
Post: #2
RE: Referencing multiple images open in Gimp
(Jun 4, 2012 10:44)bippered Wrote:  I know this is simple, but I want to know if it is possible before I attempt it Smile
So, you want someone to do that for you?

(I think it should work, though...)

Now answering your questions on
https://Gimp-Forum.net
Visit this user's website Find all posts by this user
Quote this message in a reply
Jun 4, 2012, 16:03
Post: #3
RE: Referencing multiple images open in Gimp
I just wanted to know if It could be done, before I tried the impossible Smile

I managed to do it by calling the original processing script (called 'eBay_Multi_Image') using the following :

Code:
def BatchTable(timg, tdrawable):
        images = gimp.image_list()
        imageno = len(images)
        x = 0
        while (x < imageno):
              
              currimg = images[x]
                            
              currdrawable = pdb.gimp_image_get_active_drawable(currimg)
                            
              pdb.python_fu_eBay_Multi_Image(currimg, currdrawable)
              
              x = x + 1

Probably not the nicest bit of code Smile - but it did the job.
Find all posts by this user
Quote this message in a reply
Jun 4, 2012, 16:26
Post: #4
RE: Referencing multiple images open in Gimp
Using a much more pythonic for loop and the right method in the Image class:
Code:
def BatchTable(timg, tdrawable):
        for curimg in gimp.image_list():
              pdb.python_fu_eBay_Multi_Image(currimg, currimg.active_layer)
How easier can it get Big Grin

Now answering your questions on
https://Gimp-Forum.net
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Any plugin for open multiple image in paint.net shinprog 1 325 Oct 31, 2017 11:38
Last Post: paynekj
  plugin save for web in Gimp 2.9.6 Dkk 1 191 Oct 19, 2017 09:02
Last Post: paynekj
  Script-fu: How to create new, addressable layer using gimp-floating-sel-to-layer Bertholom√§us 2 230 Aug 31, 2017 14:32
Last Post: Bertholomäus
  Late binding / COM for opening an image into GIMP? i73 2 196 Aug 4, 2017 17:39
Last Post: i73
  creating multiple sized images from one ntuck86 1 198 Jul 29, 2017 08:18
Last Post: ythgilb

Forum Jump:


GIMP ForumPortalArchiveContactTermsRSS