JavaFX Effects - Color Adjust

You can adjust the color of an image by applying the color adjust effect to it. This includes the adjustment of the Hue, Saturation, Brightness and Contrast on each pixel.

The class named ColorAdjust of the package javafx.scene.effect represents the color adjust effect, this class contains five properties namely −

  • input − This property is of the Effect type and it represents an input to the color adjust effect.

  • brightness − This property is of Double type and it represents the brightness adjustment value for this effect.

  • contrast − This property is of Double type and it represents the contrast adjustment value for this effect.

  • hue − This property is of Double type and it represents the hue adjustment value for this effect.

  • saturation − This property is of Double type and it represents the saturation adjustment value for this effect.


The following program is an example of demonstrating the color adjust effect. In here, we are embedding an image (Tutorialspoint Logo) in JavaFX scene using Image and ImageView classes. This is being done at the position 100, 70 and with a fit height and fit width of 200 and 400 respectively.

Image View

We are adjusting the color of this image using the color adjust effect. With contrast, hue, brightness and saturation values as 0.4. -0.05, 0.9, 0.8.

Save this code in a file with the name

import javafx.application.Application; 
import javafx.scene.Group; 
import javafx.scene.Scene; 
import javafx.scene.effect.ColorAdjust; 
import javafx.scene.image.Image; 
import javafx.scene.image.ImageView; 
import javafx.stage.Stage; 
public class ColorAdjustEffectExample extends Application {   
   public void start(Stage stage) {       
      //Creating an image 
      Image image = new Image("");
      //Setting the image view 
      ImageView imageView = new ImageView(image); 
      //Setting the position of the image 
      //setting the fit height and width of the image view 
      //Setting the preserve ratio of the image view 
      //Instantiating the ColorAdjust class 
      ColorAdjust colorAdjust = new ColorAdjust(); 
      //Setting the contrast value 
      //Setting the hue value 
      //Setting the brightness value 
      //Setting the saturation value 
      //Applying coloradjust effect to the ImageView node 
      //Creating a Group object  
      Group root = new Group(imageView);   
      //Creating a scene object 
      Scene scene = new Scene(root, 600, 300);  
      //Setting title to the Stage 
      stage.setTitle("Coloradjust effect example");
      //Adding scene to the stage 
      //Displaying the contents of the stage;         
   public static void main(String args[]){ 

Compile and execute the saved java file from the command prompt using the following commands.

java ColorAdjustEffectExample

On executing, the above program generates a JavaFX window as shown below.