gimp 缩放图片 python script

滤镜 -> Python Fu -> 控制台,复制粘贴下面代码。
然后 scale_image(800, 800) 图片自动缩放为 800*800 了
这个代码是傻傻的缩放,你可以把它改成按比例缩放

#!/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/

猜你喜欢

转载自www.cnblogs.com/hangj/p/11569272.html
今日推荐