imagegetpixelImage Processing Opcodesimagegetpixelimagegetpixel
Return the RGB pixel values of 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/pluginsReturn the RGB pixel values of a previously opened or created image. An image can be loaded with imageload. An empty image can be created with imagecreate.
Syntaxared, agreen, ablue imagegetpixel iimagenum, ax, aykred, kgreen, kblue imagegetpixel iimagenum, kx, kyInitializationiimagenum -- 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 imagegetpixel opcode. It uses the files imagegetpixel.csd, imageOpcode01.png and imageOpcode02.png.
Example of the imagegetpixel opcode.
Here is what the images imageOpcode01.png and imageOpcode02.pngfor the imagegetpixel example look like:
Here is a musical example of the imagegetpixel opcode. It uses the files imagegetpixel-musical.csd and imageOpcode03.png.
Example of the imagegetpixel opcode.
This is what the image imageOpcode03.png for the imagegetpixel-musical example looks like:
See alsoImage processing opcodesCreditsAuthor: Cesare MarilungoNew in version 5.08