Site iconJava PDF Blog

How to read PSD images in Java (Tutorial)

Why do PSD Images cause issues for Java Developers?

ImageIO cannot read PSD file types by default so existing Java Applications will not work with them. If you have an existing Java Application using ImageIO you will find it cannot process these images.

In this post, I will cover how to upgrade ImageIO to support PSD files so existing Java Applications which use ImageIO will work (often without having to make any code changes) and how to read PSD files in JDeli directly.

What options are there for reading PSD files in Java?

Java does not read PSD images by default so you will need to use an external library or plugin for ImageIO. JDeli offers pure Java support for reading PSD files and can also be used an ImageIO plugin.

In this article we will be using our JDeli pure Java library to read PSD files. If you are looking for a free solution, there is PSD support in the Twelve Monkeys ImageIO plugin.

How to upgrade ImageIO to read PSD files

It’s actually very simple and can be done without rewriting your existing code!

For example, the code below does not work with ImageIO for PSD images


Steps to fix with JDeli:

How to read a PSD image in Java with JDeli

  1. Add JDeli to the class or module path. (download the trial jar).
  2. Create a File handle, InputStream pointing to the raw PSD image. You can also use a byte[] containing the image data.
  3. Read the PSD image into a BufferedImage

and the Java code to read PSD with JDeli…

Other useful PSD links