#GIMP HOW TO RESIZE IMAGE MAC#
On Linux and Mac OS, any extension would work, but you have to give the fileĪfter restarting GIMP, you will have the new command conveniently located on your Layer menu: #! /usr/bin/env pythonĭef scale_layer_to_canvas_size(img, layer):įactor = min (float(img.width) / layer.width, Paste the contents bellow as a file there (if on Windows, the file must have the ".py" extension. Just check your edit->preferences->folders->plug-ins for your plug-in directory, Pick the image or layer to resize, I formated it as a python-script for GIMP as well. Since this can be done, but is not practical, even more because it does not allow you to img = gimp.image_list() layer = img.layers factor = min (float(img.width) / layer.width, float(img.height) / layer.height) layer.scale(int(layer.width * factor), int(layer.height * factor)) t_offsets((img.width - layer.width) / 2, (img.height - layer.height) / 2) On the top layer of the most recent open image.
#GIMP HOW TO RESIZE IMAGE CODE#
On the width or height, and use this ratio to scale tha layer, and then center the layer.įor your convenience, I wrote some Python code for this in a single line, in a way you can just copy and paste on the python console (filters->python->console) to apply the effect
What have to be determined programatcially is whether the ratio of the image/layer is larger You need to select the scale tool from the toolbox and click on the layer you want to scale. The way out is to use the program's scripting capabilities to perform the action: Pull requests or issue reports are welcome! Please see the contribution rules for instructions.This is easy to do, but among the hundreds of possible options to be put on the program UI, it was not "elected" to be there.
Padding Color - Color used for padding if enabled.This can be useful to avoid having sites such as Etsy and Handmade at Amazon crop your image thumbnails to an arbitrary aspect ratio.