imagegetpixelImage Processing Opcodesimagesetpixelimagesetpixel
Set the RGB value of a pixel inside a previously opened or created image.
DescriptionPlugin opcode in image. This opcode is part of the plugin repository and has to be installed separately.
The plugin repository can be found here: https://github.com/csound/pluginsSet the RGB value of a pixel inside a previously opened or created image. An image can be loaded with imageload. An empty image can be created with imagecreate and saved with imagesave.
Syntaximagesetpixel iimagenum, ax, ay, ared, agreen, ablueimagesetpixel iimagenum, kx, ky, kred, kgreen, kblueInitializationiimagenum -- the reference of the image.. It should be a value returned by imageload or imagecreate.
Performanceax (kx) -- horizontal pixel position (must be a float from 0 to 1).
ay (ky) -- vertical pixel position (must be a float from 0 to 1).
ared (kred) -- red value of the pixel (mapped to a float from 0 to 1).
agreen (kgreen) -- green value of the pixel (mapped to a float from 0 to 1).
ablue (kblue) -- blue value of the pixel (mapped to a float from 0 to 1).
Examples
Here is an example of the imagesetpixel opcode. It uses the file imagesetpixel.csd and imageOpcode02.png.
Example of the imagesetpixel opcode.
This is what the image imageOpcode02.png looks like:
and these are the new images imageNEW1.png, imageNEW2.png and imageNEW3.png:
See alsoImage processing opcodesCreditsAuthor: Cesare MarilungoNew in version 5.08