In this post of ‘How to’ articles I will be focusing on how we can read PSD images in Java.
What is PSD?
PSD (Photoshop Document) is a format used by the popular Adobe Photoshop. The software which has its own format is used by many people for graphic designing and image editing. It uses the extension ‘.psd’.
A PSD file contains multiple objects including images, shapes, text, filters and other objects often used in graphic designing/editing. This allows Photoshop users to save, transfer and make further changes to their work in the future.
JDeli is one of a few libraries that can read PSD files. JDeli can read and write a very wide range of other image formats. Here is the full list on Image file conversions supported.
How to read PSD images in Java?
Below you will find an example of how to read PSD files using Java through JDeli.
//Read Image (can also be OutputStream or byte array) File psdFile = new File("psdImage.psd"); BufferedImage image = JDeli.read(psdFile);
Or you can use the JDeli PsdDecoder directly:
PsdDecoder decoder = new PsdDecoder(); BufferedImage image = decoder.read(rawImageBytes);
You can find more tutorials in our series on handling common image formats in Java, JDeli and other image libraries.