gimp Scale Picture python script

Filter -> Python Fu -> console, copy and paste the code below.
Then scale_image(800, 800)the picture is automatically scaled to 800 * 800 of
this code is silly zoom, you can change it to be scaled

#!/usr/bin/env python

from threading import Thread
import time
from gimpfu import *
from __future__ import division

def scale_image(w, h):
    pdb.gimp_progress_init("Scaling Image...",None)
    time.sleep(0.5)
    thread = Thread(target = thread_scale_image, args = (w, h, ))
    thread.start()
    thread.join()


def thread_scale_image(w, h):
    image = gimp.image_list()[0]
    cur_w = image.width
    cur_h = image.height
    pdb.gimp_context_set_interpolation(INTERPOLATION_LANCZOS)
    pdb.gimp_image_scale(image, w, h)

https://gimpbook.com/scripting/

Guess you like

Origin www.cnblogs.com/hangj/p/11569272.html