You are here

How can I: Automatically save as JPG with an auto-numbered filename

I am using the plugin "Divide Scanned Images" and is working well. My thanks to the author as it saved me some time, but now I am still wasting time doing the following:

If I place 4 photos on my fb scanner, scan them, then run the plugin, it correctly separates the scan into four images.

The problem is I now have to file, save as on each of the four images, enter a filename and extension, answer the jpg prompt and finally get the image to save.

Is there a script/plugin/a default value or another method I can use to quickly save all 4 images as jpg with a filename that increments from the last filename, such as image0001.jpg, image 0002.jpg, etc.

Thanks in advance.

I have updated the script to include a batch mode:

Just an update -

Version 1.9 is now available at the same place:

Gary D. Huffman, II pointed out that the images weren't being processed in alphabetical order in batch mode under Ubuntu. This just adds a sort algorithm that is applied first.

-Rob A>

Could this script be modified as follows: if no filename (i.e. IMAGE), use filename of original image and append counter to the end?

I am just learning about GIMP scripts and would like to see how you do this.

Look in the body of the contactsheet plugin. You will find there how to add a counter to a filename. Also you will find some information about using filenames in one of the def routines.


I don't have the time right now but here are some tips:

Change the default in the:
SF-STRING "Save File Base Name" "IMAGE"

to be "" rather than "IMAGE"

You can check if it is blank later using:
(= (string-length inFileName) 0)

and set it to the current filename...

(car (gimp-image-get-name img)) will return the string of the image name. You will have to strip the extension if there is one.

-Rob A>

Will try you suggestions. Where can I get a list of the functions like car(..) etc?

The built in scripting used the TinyScheme language.

Just look online for scheme language references and you should find stuff.

-Rob A>

Subscribe to Comments for "How can I: Automatically save as JPG with an auto-numbered filename"