GIMP/Scripts/HalfSize

From DPWiki
< GIMP‎ | Scripts
Jump to navigation Jump to search
  • Script name: HalfSize
  • Author: Tintazul
  • Summary: Scales image to half its previous size (does not save the image)
#!/usr/bin/env python

from gimpfu import *

def half_size(image, layer):
	#get dimensions
	width = pdb.gimp_image_width (image)
	height = pdb.gimp_image_height (image)
	#scale
	pdb.gimp_image_scale (image, round(width/2), round(height/2))
	#update display
	pdb.gimp_displays_flush ()

register(
	"python_fu_half_size",
	"Scale the image to 50%",
	"Scale the image to 50%.",
	"Julio Reis", #very important note: won't allow accented u
	"Julio Reis",
	"2008-08-05",
	"<Image>/_Gutenberg/_HalfSize",
	"RGB*, GRAY*, INDEXED*",
	[],
	[],
	half_size)