Drawing PImages or PShapes with color modulation

is there any native way to print a PImage (or a PShape) with additional arguments to change the hue saturation or brightness? i would love to be able to do like image(file,x,y,w,h,hueShift,saturationShift,brightnessShift) or maybe premptively create new image variables with the modified values like PImage new = hueShift(old,ammount), does something like this exist? if not, is there any way i can access the native code for printing images to mod it myself? thanks

Hey Canslp,
you can try watching this tutorial if u want to have a better understanding of how to work with pixel
and for changing the hue of a picture try writing a function to shift the hue of the individual pixel then update the pixels with the new value

1 Like

Hello,

To list a few…

Some resources:

Examples that come with Processing:
image

:)

i mean i suppose i could manually create variants for each image. say i have a bunch of tile textures and i want to be able to change the color pallet of a scene (so i need to change the color of the texture images), should i create new image files preemptively? or is there a more native way to do it

You might look into Blend Modes, which can be toggled on/off whenever you want, which I think would fit the bill here.

If you want to get reallllly nitty gritty, you could look into writing a custom shader :thinking:

if u want to create different varient of each image u can preporcess the and save the images before runnung the animation

Hi,

maybe the ColorShift class of my image-processing library could help:

// hue is a value between 0 and 360
// offset is the color range which is accepted (in hue range)
// shift is the number of the subtracted or added hue value
PImage processedImage = ColorShift.applyHue(image, hue, offset, shift); 
1 Like

oh sweet that looks really helpful- is it just for raster pimages?

Yes, it’s for raster images, especially PImage, only. But you can use the Tools class for color calculations:

Tools.rgbToHsb(r, g, b);

After that you can change the hue value and add it to your shape.