Function Reference
— Function File: imwrite (fname, img)

Write image from octave to various file formats

Note: this requires the ImageMagick "convert" utility. get this from www.imagemagick.org if required additional documentation of options is available from the convert man page. — Function File: imwrite (fname, img)

img is a greyscale (0-255) of image in fname. — Function File: imwrite (fname, img, map)

map is a matrix of [r,g,b], 0-1 triplesm and img is a matrix on indeces into map. — Function File: imwrite (fname, r, g, b);

r, g, b are red, green, blue (0-255) compondents.

Formats for image fname

  1. Simple guess from extention, i.e. "fig.jpg", "blah.gif".
  2. Specify explicitly, i.e. "jpg:fig.jpg", "gif:blah.gif".
  3. Specify subimage for multi-image format: "tiff:file.tif[3]".
  4. Raw images (row major format) specify geometry: "raw:img[256x180]".
— Function File: imwrite (fname, img, options)
— Function File: imwrite (fname, img, map, options)
— Function File: imwrite (fname, r, g, b, options);

It is possible to give extra options to imwrite, for example:

          options= ["-rotate 25";
                    "-crop 200x200+150+150";
                    "-sample 200%" ];

will rotate, crop, and then expand the image. note that the order of operations is important

The following options are supported

-antialias
remove pixel-aliasing
-background color
background color
-blur geometry
blur the image
-border geometry
surround image with a border of color
-bordercolor color
border color
-box color
color for annotation bounding box
-charcoal radius
simulate a charcoal drawing
-colorize value
colorize the image with the fill color
-colors value
preferred number of colors in the image
-colorspace type
alternate image colorspace
-comment string
annotate image with comment
-compress type
type of image compression
-contrast
enhance or reduce the image contrast
-crop geometry
preferred size and location of the cropped image
-density geometry
vertical and horizontal density of the image
-depth value
depth of the image
-despeckle
reduce the speckles within an image
-dispose method
GIF disposal method
-dither
apply Floyd/Steinberg error diffusion to image
-draw string
annotate the image with a graphic primitive
-edge radius
apply a filter to detect edges in the image
-emboss radius
emboss an image
-enhance
apply a digital filter to enhance a noisy image
-equalize
perform histogram equalization to an image
-fill color
color to use when filling a graphic primitive
-filter type
use this filter when resizing an image
-flip
flip image in the vertical direction
-flop
flop image in the horizontal direction
-font name
font for rendering text
-frame geometry
surround image with an ornamental border
-fuzz distance
colors within this distance are considered equal
-gamma value
level of gamma correction
-geometry geometry
perferred size or location of the image
-gaussian geometry
gaussian blur an image
-gravity type
vertical and horizontal text placement
-implode amount
implode image pixels about the center
-intent type
Absolute, Perceptual, Relative, or Saturation
-interlace type
None, Line, Plane, or Partition
-label name
assign a label to an image
-level value
adjust the level of image contrast
-list type
Color, Delegate, Format, Magic, Module, or Type
-map filename
transform image colors to match this set of colors
-matte
store matte channel if the image has one
-median radius
apply a median filter to the image
-modulate value
vary the brightness, saturation, and hue
-monochrome
transform image to black and white
-morph value
morph an image sequence
-negate
replace every pixel with its complementary color
-noise radius
add or reduce noise in an image
-normalize
transform image to span the full range of colors
-opaque color
change this color to the fill color
-page geometry
size and location of an image canvas
-paint radius
simulate an oil painting
-profile filename
add ICM or IPTC information profile to image
-quality value
JPEG/MIFF/PNG compression level
-raise value
lighten/darken image edges to create a 3-D effect
-region geometry
apply options to a portion of the image
-roll geometry
roll an image vertically or horizontally
-rotate degrees
apply Paeth rotation to the image
-sample geometry
scale image with pixel sampling
-scale geometry
resize image
-segment values
segment an image
-seed value
pseudo-random number generator seed value
-shade degrees
shade the image using a distant light source
-sharpen geometry
sharpen the image
-shave geometry
shave pixels from the image edges
-shear geometry
slide one edge of the image along the X or Y axis
-size geometry
width and height of image
-solarize threshold
negate all pixels above the threshold level
-spread amount
displace image pixels by a random amount
-stroke color
color to use when stoking a graphic primitive
-strokewidth value
width of stroke
-swirl degrees
swirl image pixels about the center
-texture filename
name of texture to tile onto the image background
-threshold value
threshold the image
-tile filename
tile image when filling a graphic primitive
-transparent color
make this color transparent within the image
-treedepth value
depth of the color tree
-type type
image type
-units type
PixelsPerInch, PixelsPerCentimeter, or Undefined
-unsharp geometry
sharpen the image