Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Export all opened images in GIMP at once
#1
Scheme 
Inspired by Rich2005 over-there >  https://www.gimp-forum.net/Thread-Tip-to...es-at-once which he literally wrote the WebP part

Use case: You got a bunch of images in GIMP and you have finished to work on them, and want to export all at once in JPG or WebP or PNG, or TIFF or even BMP
Or another use case: You did slice your image using guides with Image > Slice Using Guides with a grid of 10x10 and you got 100 opened images, go to export them one by one...  Big Grin

You will want this with all those images opened (un-zip, then put the .scm file in the scripts folder)
.7z   sg-save-all-open-a.scm.7z (Size: 2.29 KB / Downloads: 681)

Now you just go to File > Export All Images As... Chose your folder, Chose the type of image, Give a generic name, and a start number (auto-numbering)

   

What changed with the original ?
A lot, like A LOT.
Export the full image and not just a layer.
Once you chose where to save and the file type, you can get a coffee or a beer, the script will care for the other million opened images and no question asked by GIMP.
No default settings from GIMP,  as before the exported JPG was bigger than the original,

Thus now you can set your settings in the code, I did comment ALL for > JPG, WebP, PNG and TIF
   
Patrice
Reply
#2
(12-06-2023, 02:34 PM)PixLab Wrote: Inspired by Rich2005 over-there >  https://www.gimp-forum.net/Thread-Tip-to...es-at-once which he literally wrote the WebP part

Use case: You got a bunch of images in GIMP and you have finished to work on them, and want to export all at once in JPG or WebP or PNG, or TIFF or even BMP
Or another use case: You did slice your image using guides with Image > Slice Using Guides with a grid of 10x10 and you got 100 opened images, go to export them one by one...  Big Grin

You will want this with all those images opened (un-zip, then put the .scm file in the scripts folder)

Now you just go to File > Export All Images As... Chose your folder, Chose the type of image, Give a generic name, and a start number (auto-numbering)



What changed with the original ?
A lot, like A LOT.
Export the full image and not just a layer.
Once you chose where to save and the file type, you can get a coffee or a beer, the script will care for the other million opened images and no question asked by GIMP.
No default settings from GIMP,  as before the exported JPG was bigger than the original,

Thus now you can set your settings in the code, I did comment ALL for > JPG, WebP, PNG and TIF

With a little effort, you can pop up the save dialog parameters only once for the first image, and reuse the settings for the other images, and avoid to edit the script (and by the way, if you edit the script while Gimp is running, you have to refresh the scripts to get Gimp to use the new version).
Reply
#3
(12-06-2023, 05:13 PM)Ofnuts Wrote: With a little effort, you can pop up the save dialog parameters only once for the first image, and reuse the settings for the other images, and avoid to edit the script

Indeed that would be very nice, and I thought about it as I think it's the right way especially for the user, but it's beyond my actual abilities with Scheme, for example yesterday I did struggle to understand that I did not need to declare multiple conditions (cond ...) for the script to work properly Undecided
I tried with RUN-WITH-LAST-VALS but it does not open a dialog it does it like RUN-NONINTERACTIVE, and when I try a combination of RUN-INTERACTIVE and RUN-WITH-LAST-VALS, I got errors, my "knowledge" (if I can say that) is very-very limited. (maybe I need to make a list of RUN-INTERACTIVE / RUN-WITH-LAST-VALS and grab the one with "(car" or "(cdr" but i need to learn more about those)

The thing is that it's quite hard to find help/resources or just some references about GIMP Scheme on the internet.

(12-06-2023, 05:13 PM)Ofnuts Wrote: (and by the way, if you edit the script while Gimp is running, you have to refresh the scripts to get Gimp to use the new version).

Yes indeed, between the Calendar last time and yesterday with this script I'm seriously thinking to add a shortcut to the Refresh Scripts, I cannot count how many time yesterday I did refresh, that was exhausting Big Grin
Patrice
Reply
#4
(12-06-2023, 10:21 PM)PixLab Wrote:
(12-06-2023, 05:13 PM)Ofnuts Wrote: With a little effort, you can pop up the save dialog parameters only once for the first image, and reuse the settings for the other images, and avoid to edit the script

Indeed that would be very nice, and I thought about it as I think it's the right way especially for the user, but it's beyond my actual abilities with Scheme, for example yesterday I did struggle to understand that I did not need to declare multiple conditions (cond ...) for the script to work properly  Undecided
I tried with RUN-WITH-LAST-VALS but it does not open a dialog it does it like  RUN-NONINTERACTIVE, and when I try a combination of RUN-INTERACTIVE and RUN-WITH-LAST-VALS, I got errors, my "knowledge" (if I can say that) is very-very limited. (maybe I need to make a list of RUN-INTERACTIVE / RUN-WITH-LAST-VALS and grab the one with "(car" or "(cdr" but i need to learn more about those)

The thing is that it's quite hard to find help/resources or just some references about GIMP Scheme on the internet.

(12-06-2023, 05:13 PM)Ofnuts Wrote: (and by the way, if you edit the script while Gimp is running, you have to refresh the scripts to get Gimp to use the new version).

Yes indeed, between the Calendar last time and yesterday with this script I'm seriously thinking to add a shortcut to the Refresh Scripts, I cannot count how many time yesterday I did refresh, that was exhausting  Big Grin

The trick is to use RUN_INTERACTIVE on the first iteration and RUN_WITH_LAST_VALS on the next. There are some gotchas, because the varoius file plugins don't react all the same way with these values, some save the layer and other save the whole image so eventually the only sane thing to do is to copy the "new from visible" to another image, and save that.
Reply
#5
(12-07-2023, 12:00 AM)Ofnuts Wrote: The trick is to use RUN_INTERACTIVE on the first iteration and RUN_WITH_LAST_VALS on the next. There are some gotchas, because the varoius file plugins don't react all the same way with these values, some save the layer and other save the whole image so eventually the only sane thing to do is to copy the "new from visible" to another image, and save that.

Thanks Ofnuts for your help, it helped to "orient" my mind
I opened a topic over-there because I'm trying to create a variable with a condition to switch between interactive and last-vals > https://www.gimp-forum.net/Thread-I-need...-in-scheme

For the new from visible to another image, I'll try to find out the Scheme's vocabulary/grammar for that Wink
Thanks for all the tips
Patrice
Reply
#6
(12-07-2023, 02:55 AM)PixLab Wrote:
(12-07-2023, 12:00 AM)Ofnuts Wrote: The trick is to use RUN_INTERACTIVE on the first iteration and RUN_WITH_LAST_VALS on the next. There are some gotchas, because the varoius file plugins don't react all the same way with these values, some save the layer and other save the whole image so eventually the only sane thing to do is to copy the "new from visible" to another image, and save that.

Thanks Ofnuts for your help, it helped to "orient" my mind
I opened a topic over-there because I'm trying to create a variable with a condition to switch between interactive and last-vals > https://www.gimp-forum.net/Thread-I-need...-in-scheme

For the new from visible to another image, I'll try to find out the Scheme's vocabulary/grammar for that  Wink
Thanks for all the tips
I literally created an account here to say "thank you"
You saved me a good hour or 2 of manual labor.
Reply
#7
Hello PixLab,

Today I spent a few hours converting .png to .gbr
A tiring (repetitive) task, I had to do it image by image.
I still have more to convert, but for today the quota has been filled.

So here is a suggestion for adding the .gbr format to this script.  Idea  Rolleyes

TIA
                               .....
Samj PortableGimp 2.10.28 - Win-10 /64.
Reply
#8
Not sure where PixLab is these days.

Quote:Today I spent a few hours converting .png to .gbr

An old script to batch convert various file types to .gbr  batch_brushes.scm  Converts a folder of a filetype images to .gbr format.
Very much original 2010, only one line changed for Gimp 2.10  but I have tried out with jpeg/png/gif/xcf test files. Writes to the same folder as the original images. Registers bottom of File menu. Does not need an image open,

I set the brush spacing to 10, if you need different edit this line

Code:
(file-gbr-save 1 image drawable newfilename newfilename 10 filename)


Attached Files
.zip   batch_brushes.zip (Size: 818 bytes / Downloads: 25)
Reply
#9
Thumbs Up 
Hello rich2005!

I also noticed that PixLab has been absent for some time now. I hope he is doing well.

The script worked like a charm.  Smile

And to think that I spent a few hours on this task the other day.  Sad

I still have other conversions to do in the next few days since I am testing some new brushes.

Initially I had difficulty running the script because I could not find its location in any menu.

After going through the menus several times without finding the script, I used the shortcut "/" (key together with the question mark '?') and that way I had access to the script.

rich2005, thank you very much!
                               .....
Samj PortableGimp 2.10.28 - Win-10 /64.
Reply


Forum Jump: