Package ca.cgjennings.imageio
Class PSDImageReader
- java.lang.Object
-
- ca.cgjennings.imageio.PSDImageReader
-
public final class PSDImageReader extends java.lang.Object
Minimal reader for PSD format image files. The individual layers are made available asImageLayer
objects.- See Also:
- PSD specification
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PSDImageReader.ColorMode
Color modes employed by PSD images.static class
PSDImageReader.PSDFormatException
-
Constructor Summary
Constructors Constructor Description PSDImageReader(java.io.File input)
Reads a PSD image from a file.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.awt.image.BufferedImage
createComposite()
Returns a composite image of all of the layers.PSDImageReader.ColorMode
getColorMode()
Returns the color mode used by the image file.ImageLayer
getLayer(int index)
Returns the layer at the requested index.int
getLayerCount()
Returns the number of layers read from the image file.
-
-
-
Method Detail
-
getColorMode
public PSDImageReader.ColorMode getColorMode()
Returns the color mode used by the image file. This has no impact on the format of decoded images returned by this class, which are always 8-bit RGB.- Returns:
- the color mode used by the file
-
getLayerCount
public int getLayerCount()
Returns the number of layers read from the image file.- Returns:
- the number of layers in the image
-
getLayer
public ImageLayer getLayer(int index)
Returns the layer at the requested index. The layer's index also indicates its Z-ordering in the layer stack. Higher indices are painted overtop of lower indices.- Parameters:
index
- the 0-based index of the layer- Returns:
- the layer at the requested index
- Throws:
java.lang.IndexOutOfBoundsException
- ifindex
< 0 orindex
>=getLayerCount()
-
createComposite
public java.awt.image.BufferedImage createComposite()
Returns a composite image of all of the layers.- Returns:
- an image representing a composite view of the image layers
-
-