Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the color of a .png image in JavaFX?

I have a PNG image like this:

enter image description here

how could the color be changed in JavaFX?

like image 480
Layynezz Avatar asked Oct 25 '25 01:10

Layynezz


1 Answers

You can use a Lighting effect, here is an example:

Lighting lighting = new Lighting(new Light.Distant(45, 90, Color.RED));
ColorAdjust bright = new ColorAdjust(0, 1, 1, 1);
lighting.setContentInput(bright);
lighting.setSurfaceScale(0.0);

imageView.setEffect(lighting);

Output:

sample output

like image 189
Miss Chanandler Bong Avatar answered Oct 26 '25 14:10

Miss Chanandler Bong