PxReduceImage

PxReduceImage — resizes images by percentage.

Syntax

PxReduceImage (image, xscale, yscale)

		

Arguments

image

An image.

xscale

The x-scale resize factor.

yscale

The y-scale resize factor.

Returns

The resized image.

Description

This function is used to resize images. The xscale and yscale are percentages of 1. Entries less than 1 reduce the image, those greater than 1 enlarge it. Images can be resized in differing proportions on the x and y axes, which permits image distortion.

Example

This example, ex_PxReduceImage.g, is included in the product distribution.

#!/usr/cogent/bin/phgamma

/*
This example shows three images in a window.  The first image is full
size, the second is reduced on the x and y axes, and the third is
enlarged on the x axis and reduced on the y axis.
*/

PtInit(nil);
require_lisp("PhotonWidgets");

win = new(PtWindow);

pic = PxLoadImage("smiley.bmp");

lab = new(PtLabel);
lab.label_type = Pt_IMAGE;
lab.label_data = pic;

lab2 = new(PtLabel);
lab2.label_type = Pt_IMAGE;
lab2.label_data = PxReduceImage(pic,.5,.5);
lab2.SetPos(100,0);

lab3 = new(PtLabel);
lab3.label_type = Pt_IMAGE;
lab3.label_data = PxReduceImage(pic,2,.25);
lab3.SetPos(100,60);

PtRealizeWidget(win);
PtMainLoop();

See Also

PxLoadImage, ImageThumbNail