CImage:SetVal


The SetVal method sets the pixel value at coordinate (x,y).

Syntax

CImage:SetVal( x, y, val )

bullet.gif    x and y are the column and row pixel coordinates, respectively, and may be passed as numbers or strings.

bullet.gif    val is a number or string to set at x,y.

Remarks

The new pixel value can be passed as a number or a string and Mira will perform the conversion to a number. To assign a single pixel value to a rectangular region, use SetRegionVal.

Example

The following script shows an image file located at path sPath being opened and the pixel value at column 53, row 100, being set to value 180.5:

I = new_image()

-- Create a CImage

I:Open( sPath )

-- Open the image from file path sPath

I:SetVal( 53, 100, 180.5 )

-- Set the pixel value at x,y

I:Save()

-- save the image

Related Topics

CImage class, GetValStr, SetVal, SetRegionVal


Mira Pro x64 Script User's Guide, Copyright Ⓒ 2023 Mirametrics, Inc. All Rights Reserved.