(set! targetheight 1080)) if option_size is 1 (1080x1435) set targetheight to 1435 ((= option_size 1) (set! targetwidth 1435) if option_size is 1 (1080x1435) set targetwidth to 1435 (set! targetheight 1024)) if option_size is 0 (1024x1024) set targetheight to 1024 (cond ((= option_size 0) (set! targetwidth 1024) if option_size is 0 (1024x1024) set targetwidth to 1024 (gimp-context-swap-colors) swops the foreground / background colours (gimp-context-set-default-colors) sets the foreground / backgroud colours to default (black / white) (gimp-context-set-interpolation 2) sets the interpolation method to (2) cubic (gimp-image-undo-group-start image) start an undo group for the image (targetheight) a variable for the target height dependant on option_size (targetwidth) a variable for the target width dependant on option_size (height (car (gimp-image-height image))) use start of gimps image height variable (width (car (gimp-image-width image))) use start of gimps image width variable (define (script-fu-dmkonlinux-web-image2 image define function and parameters in order of SF statements at end ie SF-IMAGE=image SF-DRAWABLE=drawable add ability to resize 1080 by 1435, 75% quality sRGB optomised, progressive, baseline, strip exif for "1080by1435 x.jpg" resizes files larger than 1024 by 1024 to 1024 pixels on the longest side then applies a black canvas to create a 1024 by 1024 pixel square image for "1024by1024 x.jpg" Resize the canvas to target width by target height with offsets centered.Alternatively target height by original width x (original height / target height). If the input image width is greater than the height, scale the image to the target width by original height x (original width / target width).Even so this ran to just over a hundred lines of code. I didn't fully automate it though as I was only doing five pictures at a time and I am very much a self taught beginner at coding. I used gimp and a scheme script to make the process easier as this variation in input size and ratio made the process a pain. When and where possible this will scale your images to 960 by 528 pixels, but will preserve the aspect ratio of those images that won’t scale to these dimensions exactly.I did something similar in order to create pictures that were of exactly the same dimensions for a html slideshow, even if the original file had been cropped, or was portrait or landscape in orientation. Perhaps you have a height and width you are aiming for, but want to preserve the aspect ratio. This will scale all of your images to a width of 960 pixels, the height will be scaled accordingly, preserving the aspect ratio. Perhaps the height isn’t as important as the width. png files in your directory to a size of 960 pixels by 528 pixels. Place all the images you want to scale in a directory and navigate to that location via command line. You’re in luck! With the ImageMagick -resize option, you can quickly and easily batch scale those images to a manageable size. The last thing you want to do is resize them manually. Unfortunately, this gives you a Pictures directory filled with massive images not optimized for uploading to, and displaying on, a web page. Let’s say you’re writing a series of Blender tutorials and you’re using PrintScreen to grab screen shots.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |