Provides standard image functions.
Version | Extensions (Ignoring case) |
---|---|
9.5.beta | .jpg, .jpeg |
9.5.rc | .jpg, .jpeg, .png |
The following statement may be used to import the image library:
import image;
Name | Description |
---|---|
read_channel_data | Read (A)RGB channel data, width, and height from a JPEG image into an object. |
write_channel_data | Write (A)RGB channel data with optional quality using data from an object into a JPEG. |
Creates an object with width
int, height
int, red
int array, green
int array, blue
int array, and alpha
int array.
The alpha
int array is only defined when reading images with extension .png
.
string imgData1 = "imgData1";
call read_channel_data : "1Hill.JPG", imgData1;
int redIdx = 0;
int imageChannelLength = imgData1.width * imgData1.height;
println "Width x Height: ", imgData1.width, " ", imgData1.height;
println "Image channel length: ", imageChannelLength;
int redLength = 0;
sizeof imgData1.red redLength;
println "Size of red channel: ", redLength;
while redIdx < imageChannelLength;
print imgData1.red[redIdx], ", ";
redIdx += 1;
if redIdx > 100;
break;
end;
end;
println "";
Arguments:
filename: string, channelObjectName: string, outputQuality?: number
The outputQuality
argument is optional for .jpg
and .jpeg
extensions, and should not be provided for .png
extensions.
int writeResult = 0;
int outputQuality = 90;
call write_channel_data : "out.JPG", "imgData1", outputQuality -> writeResult;
println "Image write result: ", writeResult;