Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to save a image as JPG

user753838-OracleApr 10 2015 — edited Apr 12 2015

Hi, My JavaFX code like this:

            WritableImage image = scene.snapshot(null); 
            File outputFile = new File("C:\\PSB\\JavaFXApplication1\\src\\test0.jpg");
           

ImageIO.write(SwingFXUtils.fromFXImage(image, null), "jpg", outputFile); 

When open this jpg, its background is in orange color. For png type, it works great.

Thanks

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 10 2015
Added on Apr 10 2015
2 comments
1,082 views