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: 494)

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


Forum Jump: