RSS/Atom feed Twitter
Site is read-only, email is disabled

Batch processing resizing images

This discussion is connected to the gimp-user-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

5 of 5 messages available
Toggle history

Please log in to manage your subscriptions.

Batch processing resizing images Eric van Oorschot 17 Aug 20:27
  Batch processing resizing images Sven Neumann 17 Aug 20:38
   Batch processing resizing images Eric van Oorschot 18 Aug 19:34
    Batch processing resizing images Sven Neumann 18 Aug 21:38
  Batch processing resizing images saulgoode@flashingtwelve.brickfilms.com 18 Aug 23:19
Eric van Oorschot
2009-08-17 20:27:11 UTC (over 15 years ago)

Batch processing resizing images

Probably an old question, but since I am new to this list I just post it. How do I batch process files in gimp and resize the images while keeping the aspect ratio of the original file. I modified the batch processing example on the Gimp web pages, but it just doesn't work. I have included the modified script below. As you can see I try to resize the images to a maximum size of 1920x1200px.

(define (batch-unsharp-mask pattern radius amount threshold) (let* ((filelist (cadr (file-glob pattern 1)))) (while (not (null? filelist))
(let* ((filename (car filelist)) (image (car (gimp-file-load RUN-NONINTERACTIVE filename filename))) (drawable (car (gimp-image-get-active-layer image))) (width (car(gimp-image-width image))) (height (car(gimp-image-height image))) (scale min( (/ 1920 width) (/ 1200 height))) (xsize (* scale width))
(ysize (* scale height)))
(plug-in-unsharp-mask RUN-NONINTERACTIVE image drawable radius amount threshold) (gimp-image-scale image (floor xsize) (floor ysize)) (gimp-file-save RUN-NONINTERACTIVE image drawable filename filename) (gimp-image-delete image)) (set! filelist (cdr filelist)))))

Sven Neumann
2009-08-17 20:38:28 UTC (over 15 years ago)

Batch processing resizing images

Hi,

On Mon, 2009-08-17 at 20:27 +0200, Eric van Oorschot wrote:

How do I batch process files in gimp and resize the images while keeping the aspect ratio of the original file. I modified the batch processing example on the Gimp web pages, but it just doesn't work.

It would help a lot if you told us what exactly does not work.

Sven

Eric van Oorschot
2009-08-18 19:34:36 UTC (over 15 years ago)

Batch processing resizing images

Hi,

I run this command from the (linux) commandline:

gimp -i -b '(batch-unsharp-mask "*.jpg" 5.0 0.5 0)' -b '(gimp-quit 0)'

The response to this command is:

batch command experienced an execution error

If I comment out the line with 'gimp-image-scale', the batch processing works but off course without scaling.

Since the 'let' statement creates local variables I also tried to put the 'gimp-image-scale' line within the braces, but this also results in the same error message. I tried to debug the script using the Scheme command display, but this was also unsuccesfull. The calculation of the scale variable works in Scheme using Guile, so that part of the script should be OK. But now I am stuck.

Regards,

Eric

Sven Neumann wrote:

Hi,

On Mon, 2009-08-17 at 20:27 +0200, Eric van Oorschot wrote:

How do I batch process files in gimp and resize the images while keeping the aspect ratio of the original file. I modified the batch processing example on the Gimp web pages, but it just doesn't work.

It would help a lot if you told us what exactly does not work.

Sven

Sven Neumann
2009-08-18 21:38:02 UTC (over 15 years ago)

Batch processing resizing images

Hi,

On Tue, 2009-08-18 at 19:34 +0200, Eric van Oorschot wrote:

The calculation of the scale variable works in Scheme using Guile, so that part of the script should be OK. But now I am stuck.

Guile is not the same Scheme dialect than what Script-Fu is using. Did you check that floor is at all supported in Script-Fu?

Sven

saulgoode@flashingtwelve.brickfilms.com
2009-08-18 23:19:02 UTC (over 15 years ago)

Batch processing resizing images

Quoting Eric van Oorschot :

:
:
(scale min( (/ 1920 width) (/ 1200 height))) :
:

Your invocation of 'min(' is incorrect -- it should be '(min'. This probably results in either 'xsize' or 'ysize' evaluating to "0" and thus a failure of 'gimp-image-scale'.