Reference imageShader()

imageShader()

Sets the p5.Shader object to apply for images.

This method allows the user to apply a custom shader to images, enabling advanced visual effects such as pixel manipulation, color adjustments, or dynamic behavior. The shader will be applied to the image drawn using the image() function.

The shader will be used exclusively for:

  • image() calls, applying only when drawing 2D images.
  • This shader will NOT apply to images used in texture() or other 3D contexts. Any attempts to use the imageShader in these cases will be ignored.

Examples

Syntax

imageShader(s)

Parameters

s
p5.Shader: p5.Shader object to apply for images.
Notice any errors or typos? Please let us know. Please feel free to edit src/webgl/material.js and open a pull request!

Related References