0

I'm using gimp 2.10 on a Debian 12 system.

I need to use gimp because, after some manuals tests using gimp graphical interface, I noticed the quality of resized/converted images is better than with imagemagik or inkscape.

My gimp script successfully convert the SVG to PNG, but it doesn't resize it.

Here is my script:

(define (convertresize in_filename out_filename width height)
    (let* (
            (image (car (gimp-file-load RUN-NONINTERACTIVE in_filename "")))
            (drawable (car (gimp-image-get-active-layer image)))
            (gimp-image-scale-full image width height INTERPOLATION-CUBIC)
            (gimp-layer-resize-to-image-size drawable)
        )
        (gimp-file-save RUN-NONINTERACTIVE image drawable out_filename out_filename)
        (gimp-image-delete image)
    )
)

The script is in ~/.config/GIMP/2.10/scripts folder. I launch it with the following command:

gimp -i -b '(convertresize "./image.svg" "./image.png" 24 24)' -b '(gimp-quit 0)'

So, I would like to know why my script doesn't resize the image.

1 Answer 1

0

The transformations done to the image have to be done outside the section that loads the image.

Here is the correct code:

(define (convertresize in_filename out_filename width height)
    (let* (
            (image (car (gimp-file-load RUN-NONINTERACTIVE in_filename "")))
            (drawable (car (gimp-image-get-active-layer image)))
        )
        (gimp-image-undo-disable image)
        (gimp-image-scale-full image width height INTERPOLATION-CUBIC)
        (gimp-layer-resize-to-image-size drawable)
        (gimp-file-save RUN-NONINTERACTIVE image drawable out_filename out_filename)
        (gimp-image-delete image)
    )
)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.