You are here

need Script code for image fixed size?

i want script code for
if image height>width
then height=300 and width is related to height size
else
width=300 and height is related to width size
(here image size is like 300 x (less than 300) or (less than 300 X 300))
now i want to create canvas 320 X 320 for that image with white background color
now the image size is 320 X 320 with white canvas background color
my gimp version 2.8 and i need script-Fu code
and somebody sent to me like this

let* ((width (car (gimp-drawable-width layer)))
(height (car (gimp-drawable-height layer)))
(aspect (/ height width)) )
(if (< (/ 300 width) (/ 300 height))
(gimp-layer-scale layer
300
(* 300 aspect)
TRUE)
(gimp-layer-scale layer
(/ 300 aspect)
300
TRUE )))
(gimp-context-set-background '(255 255 255))
(gimp-layer-resize layer
320
320
(/ (- 320 (car (gimp-drawable-width layer))) 2)
(/ (- 320 (car (gimp-drawable-height layer))) 2))
(gimp-layer-flatten layer)
but it is not working and am getting error like (Refresh script Message
Error while loading C:\Users\Kumar Kovuru 1\.gimp-2.8\scripts\Image-Background.scm:

Error: (C:\Users\Kumar Kovuru 1\.gimp-2.8\scripts\Image-Background.scm : 12) eval: unbound variable: layer )could you correct it once

need Script code for image fixed size?

http://chiselapp.com/user/saulgoode/repository/script-fu/artifact/e9415e...

Click on "Download" command at top of page to download the file.

Command is added as "Filters->Misc->Kumar Kovuru".

Subscribe to Comments for "need Script code for image fixed size?"