Coyote Graphics Routines

Date: Fri Mar 27 12:14:20 2015

single page | use frames     summary     class     fields     routine details     file attributes

.\

cgresizeraster.pro


top cgResizeRaster

Graphics

cgResizeRaster, rasterfile [, percentage] [, /KEEP_ORIGINAL] [, HEIGHT=integer] [, /SILENT] [, WIDTH=integer]

The purpose of this program is to resize a raster file according to instructions from the user. It was designed specifically to resize the extremely large raster files created by IDL's function graphics commands from within an IDL program. It requires ImageMagick be installed and able to be called from a SPAWN command from within IDL.

Parameters

rasterfile in required type=string

Set this parameter to the name of the raster file to be resized. The resized file will have this same name unless the KEEP_ORIGINAL keyword is set, in which case an "_rs" will be appended to the base name given by this parameter.

percentage in optional type=float

A resize percentage. A value of 50, for example, will make the output file half its original size. A file may be made bigger by specifying a percentage greater than 100 (e.g. 150). The default is to calculate a precentage that makes the longest dimension of the output file approximately 600 pixels.

Keywords

KEEP_ORIGINAL in optional type=boolean

Set this keyword to keep the original file. Otherwise, the file is overwritten with the resized file. If this keyword is set, the output file will use the same name as the input file, except an "_rs" will be appended to the base name of the input file.

HEIGHT in optional type=integer

Set this keyword to set the height of the resulting raster file in pixel units. The width of the raster will be such as to preserve the aspect ratio of the starting image. This keyword cannot be used if the WIDTH keyword is used at the same time.

SILENT in optional type=boolean default=0

Set this keyword to suppress printed output from the program.

WIDTH in optional type=integer

Set this keyword to set the resulting width of the raster file. The height of the raster will be such as to preserve the aspect ratio of the starting image. This keyword cannot be used if the HEIGHT keyword is used at the same time.

Examples

Here is how to use this program:

IDL> cgResizeRaster, 'picture.png', /Keep_Original, Width=500

Author information

Author:

FANNING SOFTWARE CONSULTING:

David W. Fanning 1645 Sheely Drive Fort Collins, CO 80526 USA Phone: 970-221-0438 E-mail: david@idlcoyote.com Coyote's Guide to IDL Programming: http://www.idlcoyote.com

Copyright:

Copyright (c) 2014, Fanning Software Consulting, Inc.

History:

Change History:

Written, 15 January 2014 by David W. Fanning.

File attributes

Modification date: Fri Mar 27 11:07:38 2015
Lines: 181
Docformat: rst rst