This week sees an interesting addition to our JDeli image library. We have now developed our own PSD decoder. In this blog article I will be explaining: what the PSD file format is, what it is used for and how you can use it as part of our JDeli library.
Where have I heard of PSD?
If you have ever used Adobe’s Photoshop software then you will no doubt have seen this type of file before. PSD stands for PhotoShop Document and is Adobe’s layered image file format. Photoshop’s popularity has shown that the PSD format has pretty much become a standard in the bitmapped image world.
PSD files can have a maximum height and width of 30,000 pixels. PSD file sizes can reach up to 2GB. Adobe has also enforced a limit of no more than 8000 layers (though not many people ever get past the 6000 layer mark).
Why would I want to use this format?
This format was primarily made to preserve multiple layers of graphics art in a saved file. By doing this it meant that further editing could be carried out later. The preservation of each layer and their states allows the user the ability to edit each individual layer or graphics object separately. Ultimately giving you a lot more control over how to construct and edit your images over time. PSD files can also store information regarding applied masks, transparency values, text, colours used and clipping paths among other alterations for each individual layer.
The beauty of having multiple image layers enables illustrations to be created where objects can be moved, stretched, cropped and generally edited without other layers being affected. On top of that layers can easily be reordered or made invisible to suit your needs. PSD also allows for the combination of both pixel and vector based objects, lifting the restriction on using either one or the other.
Once you are happy with your PSD you can effectively flatten it to create a final image which can be exported to many different image formats including JPEG and GIF’s. The PSD file is kept as a sort of blueprint which you can go back to, easily edit and again create a file in a format that is suitable for your required purpose.
How do I decode this format in JDeli?
As I mentioned previously, PSD documents are editable blueprints that can be used to create a final image in a different file format e.g. PNG. JDeli allows us to easily get the final image data so that it can be used with another encoder or image writer later. e.g.
RandomAccessFile raf = new RandomAccessFile("C:\path\to\your\file.psd", "r"); PsdDecoder decoder = new PsdDecoder(raf); BufferedImage decodedImage = decoder.read(); raf.close();
Features included in the JDeli PSD Decoder
ColorSpace : RGB, RGBA, CMYK, CMYKA, GrayScale, Indexed and Lab color photoshop images.
Latest posts by Georgia Ingham (see all)
- JavaOne 2017 Community Keynote through Pictures - October 16, 2017
- JavaOne 2017 Developer Keynote through Pictures - October 13, 2017
- JavaOne 2017 Java Keynote through Pictures - October 12, 2017
- Talks I am looking forward to at JavaOne 2017 - September 29, 2017
- Things to do in Boston around Business Of Software USA 2016 - September 8, 2016