JavaFX Effects - SepiaTone

On applying the Sepia Tone Effect to a node in JavaFX (image in general), it is toned with a reddish brown color.

The class named SepiaTone of the package javafx.scene.effect represents the sepia tone effect, this class contains two properties, which are −

  • level − This property is of double type representing the intensity of this effect. The range of this property is 0.0 to 1.0.

  • input − This property is of the type effect and it represents an input to the sepia tone effect.


The following program is an example demonstrating the Sepia Tone Effect of JavaFX. In here, we are embedding the following image (tutorialspoint logo) in JavaFX scene using Image and ImageView classes. This is done at the position 100, 70 along with fit height and fit width 200 and 400 respectively.


To this image, we are applying the Sepia Tone Effect with the level value 0.9. Save this code in a file with name

import javafx.application.Application; 
import javafx.scene.Group; 
import javafx.scene.Scene; 
import javafx.scene.effect.SepiaTone; 
import javafx.scene.image.Image; 
import javafx.scene.image.ImageView; 
import javafx.stage.Stage;  

public class SepiaToneEffectExample 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 
      //Instanting the SepiaTone class 
      SepiaTone sepiaTone = new SepiaTone(); 
      //Setting the level of the effect 
      //Applying SepiaTone effect to the image 
      //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("Sepia tone 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 SepiaToneEffectExample    

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

SepiaTone Effect