vovashadow.blogg.se

Gimp scale
Gimp scale












gimp scale

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,

gimp scale

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 scale 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 The way out is to use the program's scripting capabilities to perform the action: 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.














Gimp scale