CImage:Offset1d


The Offset method offsets the image by an integral pixel amount along axis 1 (column position). By default, pixels that become blank are filled with value 0. Blank pixels also can be assigned a specific value and, optionally, random noise. To shift in the column/row plane or along multiple or higher dimensions, use the Offset2d or Offset method.

Syntax

bSuccess = CImage:Offset1d( nOffsetX )

bSuccess = CImage:Offset1d( nOffsetX, Value )

bSuccess = CImage:Offset1d( nOffsetX, Value, Sigma )

where

    nOffsetX is the pixel shift in column number. This is an integer and may be positive or negative.

    Value is the value of blank pixels, and may be a number or string.

    Sigma is the noise sigma to apply to blank pixels, and may be a number or string.

    bSuccess is the returned success code. On success it is true, otherwise false.

  

If the image has a numeric data type, specify the Value and Sigma as a number, like 45.62. If the image has a color data type with 3 or 4 channels, specify the Value and Sigma as a string, like "15,22.4,75.112". The nOffset may be a positive or negative value. If you do not want to add noise to the blank region, omit it from the argument list.

Example

The following script opens an image from the file named sFileName and shifts it +24 pixels along the column direction. Blank background pixels are set to value=1000 and noise sigma=8.25:

I = CImage:new()

-- create a new CImage object

I:Open( sFileName )

-- open the image from a file

I:Offset1d( 24, 1000, 8.25 )

-- shift the image

I:Save()

-- save back to the file

Related Topics

Offset

Offset2d

Expand

ExpandOffset

CImage class