Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Scaling the image to 1/2 size
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from gimpfu import *
def plugin_main(img, layer):
width = img.width
height = img.height
resizedWidth = width / 2
resizedHeight = height / 2
name = ""
if img.filename:
name = os.path.basename(img.filename)
pdb.gimp_image_scale(img, resizedWidth, resizedHeight)
"Original Size: %d,%d\n" % (width, height) +
"Resized Size: %d,%d\n\n" % (resizedWidth, resizedHeight) +
"CSS: \nwidth: %dpx;\nheight: %dpx;\n\n" % (resizedWidth, resizedHeight) +
"img: <img src=\"%s\" width=\"%d\" height=\"%d\" />" % (name, resizedWidth, resizedHeight)
"Scale the image to the half size",
"Scale the image to the half size",
"Yoichi Imai",
"Yoichi Imai",
"<Image>/Image/Scale to Half Size",
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment