public class PsdOptions extends ImageOptionsBase
The PSD file format create options.
This example demonstrates the use of Aspose.Imaging for Java API to convert Images to PSD format. To achieve this goal this example loads an existing image and then saves it back to PSD format.
// Create an instance of image class and initialize it with an existing file through File path com.aspose.imaging.Image image = com.aspose.imaging.Image.load("C:\\temp\\sample.bmp"); try { // Create an instance of PsdOptions class com.aspose.imaging.imageoptions.PsdOptions psdOptions = new com.aspose.imaging.imageoptions.PsdOptions(); // Set the CompressionMethod as RLE // Note: Other supported CompressionMethod is CompressionMethod.RAW [No Compression] psdOptions.setCompressionMethod(com.aspose.imaging.fileformats.psd.CompressionMethod.RLE); // Set the ColorMode to GrayScale // Note: Other supported ColorModes are ColorModes.Bitmap and ColorModes.RGB psdOptions.setColorMode(com.aspose.imaging.fileformats.psd.ColorModes.Grayscale); // Save the image to disk with the supplied PsdOptions settings image.save("C:\\temp\\output.psd", psdOptions); } finally { image.dispose(); }
Constructor and Description |
---|
PsdOptions()
Initializes a new instance of the
PsdOptions class. |
PsdOptions(PsdOptions options)
Initializes a new instance of the
PsdOptions class. |
Modifier and Type | Method and Description |
---|---|
short |
getChannelBitsCount()
Gets or sets the bits count per color channel.
|
short |
getChannelsCount()
Gets the color channels count.
|
short |
getColorMode()
Gets or sets the PSD color mode.
|
short |
getCompressionMethod()
Gets or sets the PSD compression method.
|
byte |
getPsdVersion()
Gets the file format version.
|
PsdVectorizationOptions |
getVectorizationOptions()
Gets the PSD vectorization options.
|
int |
getVersion()
Gets or sets the PSD file version.
|
XmpPacketWrapper |
getXmpData()
Get or set XMP data container
|
boolean |
isRefreshImagePreviewData()
Gets a value indicating whether [refresh image preview data] - option used to maximize compatibility with another PSD image viewers.
|
boolean |
isRemoveGlobalTextEngineResource()
Gets a value indicating whether - Remove the global text engine resource - Used for some text-layered PSD files, in only case, when they can not be opened in Adobe Photoshop after processing (mostly for absent fonts text layers related).
|
void |
setChannelBitsCount(short value)
Gets or sets the bits count per color channel.
|
void |
setChannelsCount(short value)
Sets the color channels count.
|
void |
setColorMode(short value)
Gets or sets the PSD color mode.
|
void |
setCompressionMethod(short value)
Gets or sets the PSD compression method.
|
void |
setPsdVersion(byte value)
Sets the file format version.
|
void |
setRefreshImagePreviewData(boolean value)
Sets a value indicating whether [refresh image preview data] - option used to maximize compatibility with another PSD image viewers.
|
void |
setRemoveGlobalTextEngineResource(boolean value)
Sets a value indicating whether - Remove the global text engine resource - Used for some text-layered PSD files, in only case, when they can not be opened in Adobe Photoshop after processing (mostly for absent fonts text layers related).
|
void |
setVectorizationOptions(PsdVectorizationOptions value)
Sets the PSD vectorization options.
|
void |
setVersion(int value)
Gets or sets the PSD file version.
|
void |
setXmpData(XmpPacketWrapper value)
Get or set XMP data container
|
deepClone, getBufferSizeHint, getFullFrame, getMultiPageOptions, getPalette, getProgressEventHandler, getResolutionSettings, getSource, getVectorRasterizationOptions, setBufferSizeHint, setFullFrame, setMultiPageOptions, setPalette, setProgressEventHandler, setResolutionSettings, setSource, setVectorRasterizationOptions
close, dispose, getDisposed
public PsdOptions()
Initializes a new instance of the PsdOptions
class.
public PsdOptions(PsdOptions options)
Initializes a new instance of the PsdOptions
class.
options
- The options.public XmpPacketWrapper getXmpData()
Get or set XMP data container
getXmpData
in class ImageOptionsBase
public void setXmpData(XmpPacketWrapper value)
Get or set XMP data container
setXmpData
in class ImageOptionsBase
value
- The XMP data container.public int getVersion()
Gets or sets the PSD file version.
Value: The PSD file version.public void setVersion(int value)
Gets or sets the PSD file version.
Value: The PSD file version.This example shows how to save a PNG image to PSD format using various PSD-specific options.
String dir = "c:\\temp\\"; // Create a PNG image of 100x100 px. com.aspose.imaging.fileformats.png.PngImage pngImage = new com.aspose.imaging.fileformats.png.PngImage(100, 100, com.aspose.imaging.fileformats.png.PngColorType.TruecolorWithAlpha); try { // Define a linear blue-transparent gradient. com.aspose.imaging.brushes.LinearGradientBrush gradientBrush = new com.aspose.imaging.brushes.LinearGradientBrush( new com.aspose.imaging.Point(0, 0), new com.aspose.imaging.Point(pngImage.getWidth(), pngImage.getHeight()), com.aspose.imaging.Color.getBlue(), com.aspose.imaging.Color.getTransparent()); com.aspose.imaging.Graphics graphics = new com.aspose.imaging.Graphics(pngImage); // Fill the PNG image with the linear blue-transparent gradient. graphics.fillRectangle(gradientBrush, pngImage.getBounds()); // The following options will be used to save the PNG image to PSD format. com.aspose.imaging.imageoptions.PsdOptions saveOptions = new com.aspose.imaging.imageoptions.PsdOptions(); // The number of bits per channel saveOptions.setChannelBitsCount((byte) 8); // The number of channels. One channel for each color component R,G,B,A saveOptions.setChannelsCount((short) 4); // The color mode saveOptions.setColorMode(com.aspose.imaging.fileformats.psd.ColorModes.Rgb); // No compression saveOptions.setCompressionMethod(com.aspose.imaging.fileformats.psd.CompressionMethod.Raw); // Default version is 6 saveOptions.setVersion(6); java.io.FileOutputStream stream = new java.io.FileOutputStream(dir + "saveoptions.psd"); try { pngImage.save(stream, saveOptions); System.out.println("The size of the PSD image with RAW compression: " + stream.getChannel().size()); } finally { stream.close(); } stream = new java.io.FileOutputStream(dir + "saveoptions.RLE.psd"); try { // The RLE compression allows to reduce the size of the output image saveOptions.setCompressionMethod(com.aspose.imaging.fileformats.psd.CompressionMethod.RLE); pngImage.save(stream, saveOptions); System.out.println("The size of the PSD image with RLE compression: " + stream.getChannel().size()); } finally { stream.close(); } // The output may look like this: // The size of the PSD image with RAW compression: 40090 // The size of the PSD image with RLE compression: 16185 } finally { pngImage.dispose(); }
public short getCompressionMethod()
Gets or sets the PSD compression method.
Value: The compression method.public void setCompressionMethod(short value)
Gets or sets the PSD compression method.
Value: The compression method.This example demonstrates the use of Aspose.Imaging for Java API to convert Images to PSD format. To achieve this goal this example loads an existing image and then saves it back to PSD format.
// Create an instance of image class and initialize it with an existing file through File path com.aspose.imaging.Image image = com.aspose.imaging.Image.load("C:\\temp\\sample.bmp"); try { // Create an instance of PsdOptions class com.aspose.imaging.imageoptions.PsdOptions psdOptions = new com.aspose.imaging.imageoptions.PsdOptions(); // Set the CompressionMethod as RLE // Note: Other supported CompressionMethod is CompressionMethod.RAW [No Compression] psdOptions.setCompressionMethod(com.aspose.imaging.fileformats.psd.CompressionMethod.RLE); // Set the ColorMode to GrayScale // Note: Other supported ColorModes are ColorModes.Bitmap and ColorModes.RGB psdOptions.setColorMode(com.aspose.imaging.fileformats.psd.ColorModes.Grayscale); // Save the image to disk with the supplied PsdOptions settings image.save("C:\\temp\\output.psd", psdOptions); } finally { image.dispose(); }
public final byte getPsdVersion()
Gets the file format version. It can be PSD or PSB.
Value: The file format version.public final void setPsdVersion(byte value)
Sets the file format version. It can be PSD or PSB.
Value: The file format version.value
- the file format version.public short getColorMode()
Gets or sets the PSD color mode.
Value: The color mode.public void setColorMode(short value)
Gets or sets the PSD color mode.
Value: The color mode.This example demonstrates the use of Aspose.Imaging for Java API to convert Images to PSD format. To achieve this goal this example loads an existing image and then saves it back to PSD format.
// Create an instance of image class and initialize it with an existing file through File path com.aspose.imaging.Image image = com.aspose.imaging.Image.load("C:\\temp\\sample.bmp"); try { // Create an instance of PsdOptions class com.aspose.imaging.imageoptions.PsdOptions psdOptions = new com.aspose.imaging.imageoptions.PsdOptions(); // Set the CompressionMethod as RLE // Note: Other supported CompressionMethod is CompressionMethod.RAW [No Compression] psdOptions.setCompressionMethod(com.aspose.imaging.fileformats.psd.CompressionMethod.RLE); // Set the ColorMode to GrayScale // Note: Other supported ColorModes are ColorModes.Bitmap and ColorModes.RGB psdOptions.setColorMode(com.aspose.imaging.fileformats.psd.ColorModes.Grayscale); // Save the image to disk with the supplied PsdOptions settings image.save("C:\\temp\\output.psd", psdOptions); } finally { image.dispose(); }
public short getChannelBitsCount()
Gets or sets the bits count per color channel.
Value: The bits count per color channel.public void setChannelBitsCount(short value)
Gets or sets the bits count per color channel.
Value: The bits count per color channel.This example shows how to save a PNG image to PSD format using various PSD-specific options.
String dir = "c:\\temp\\"; // Create a PNG image of 100x100 px. com.aspose.imaging.fileformats.png.PngImage pngImage = new com.aspose.imaging.fileformats.png.PngImage(100, 100, com.aspose.imaging.fileformats.png.PngColorType.TruecolorWithAlpha); try { // Define a linear blue-transparent gradient. com.aspose.imaging.brushes.LinearGradientBrush gradientBrush = new com.aspose.imaging.brushes.LinearGradientBrush( new com.aspose.imaging.Point(0, 0), new com.aspose.imaging.Point(pngImage.getWidth(), pngImage.getHeight()), com.aspose.imaging.Color.getBlue(), com.aspose.imaging.Color.getTransparent()); com.aspose.imaging.Graphics graphics = new com.aspose.imaging.Graphics(pngImage); // Fill the PNG image with the linear blue-transparent gradient. graphics.fillRectangle(gradientBrush, pngImage.getBounds()); // The following options will be used to save the PNG image to PSD format. com.aspose.imaging.imageoptions.PsdOptions saveOptions = new com.aspose.imaging.imageoptions.PsdOptions(); // The number of bits per channel saveOptions.setChannelBitsCount((byte) 8); // The number of channels. One channel for each color component R,G,B,A saveOptions.setChannelsCount((short) 4); // The color mode saveOptions.setColorMode(com.aspose.imaging.fileformats.psd.ColorModes.Rgb); // No compression saveOptions.setCompressionMethod(com.aspose.imaging.fileformats.psd.CompressionMethod.Raw); // Default version is 6 saveOptions.setVersion(6); java.io.FileOutputStream stream = new java.io.FileOutputStream(dir + "saveoptions.psd"); try { pngImage.save(stream, saveOptions); System.out.println("The size of the PSD image with RAW compression: " + stream.getChannel().size()); } finally { stream.close(); } stream = new java.io.FileOutputStream(dir + "saveoptions.RLE.psd"); try { // The RLE compression allows to reduce the size of the output image saveOptions.setCompressionMethod(com.aspose.imaging.fileformats.psd.CompressionMethod.RLE); pngImage.save(stream, saveOptions); System.out.println("The size of the PSD image with RLE compression: " + stream.getChannel().size()); } finally { stream.close(); } // The output may look like this: // The size of the PSD image with RAW compression: 40090 // The size of the PSD image with RLE compression: 16185 } finally { pngImage.dispose(); }
public short getChannelsCount()
Gets the color channels count.
public void setChannelsCount(short value)
Sets the color channels count.
value
- The color channels count.This example shows how to save a PNG image to PSD format using various PSD-specific options.
String dir = "c:\\temp\\"; // Create a PNG image of 100x100 px. com.aspose.imaging.fileformats.png.PngImage pngImage = new com.aspose.imaging.fileformats.png.PngImage(100, 100, com.aspose.imaging.fileformats.png.PngColorType.TruecolorWithAlpha); try { // Define a linear blue-transparent gradient. com.aspose.imaging.brushes.LinearGradientBrush gradientBrush = new com.aspose.imaging.brushes.LinearGradientBrush( new com.aspose.imaging.Point(0, 0), new com.aspose.imaging.Point(pngImage.getWidth(), pngImage.getHeight()), com.aspose.imaging.Color.getBlue(), com.aspose.imaging.Color.getTransparent()); com.aspose.imaging.Graphics graphics = new com.aspose.imaging.Graphics(pngImage); // Fill the PNG image with the linear blue-transparent gradient. graphics.fillRectangle(gradientBrush, pngImage.getBounds()); // The following options will be used to save the PNG image to PSD format. com.aspose.imaging.imageoptions.PsdOptions saveOptions = new com.aspose.imaging.imageoptions.PsdOptions(); // The number of bits per channel saveOptions.setChannelBitsCount((byte) 8); // The number of channels. One channel for each color component R,G,B,A saveOptions.setChannelsCount((short) 4); // The color mode saveOptions.setColorMode(com.aspose.imaging.fileformats.psd.ColorModes.Rgb); // No compression saveOptions.setCompressionMethod(com.aspose.imaging.fileformats.psd.CompressionMethod.Raw); // Default version is 6 saveOptions.setVersion(6); java.io.FileOutputStream stream = new java.io.FileOutputStream(dir + "saveoptions.psd"); try { pngImage.save(stream, saveOptions); System.out.println("The size of the PSD image with RAW compression: " + stream.getChannel().size()); } finally { stream.close(); } stream = new java.io.FileOutputStream(dir + "saveoptions.RLE.psd"); try { // The RLE compression allows to reduce the size of the output image saveOptions.setCompressionMethod(com.aspose.imaging.fileformats.psd.CompressionMethod.RLE); pngImage.save(stream, saveOptions); System.out.println("The size of the PSD image with RLE compression: " + stream.getChannel().size()); } finally { stream.close(); } // The output may look like this: // The size of the PSD image with RAW compression: 40090 // The size of the PSD image with RLE compression: 16185 } finally { pngImage.dispose(); }
public boolean isRemoveGlobalTextEngineResource()
Gets a value indicating whether - Remove the global text engine resource - Used for some text-layered PSD files, in only case, when they can not be opened in Adobe Photoshop after processing (mostly for absent fonts text layers related). After using this option, user need to Make next in opened in Photoshop file: Menu "Text" -> "Process absent fonts". After that operation all text will appear again. Please note, that this operation may cause some final layout changes.
true
if [remove global text engine resource]; otherwise, false
.public void setRemoveGlobalTextEngineResource(boolean value)
Sets a value indicating whether - Remove the global text engine resource - Used for some text-layered PSD files, in only case, when they can not be opened in Adobe Photoshop after processing (mostly for absent fonts text layers related). After using this option, user need to Make next in opened in Photoshop file: Menu "Text" -> "Process absent fonts". After that operation all text will appear again. Please note, that this operation may cause some final layout changes.
value
- true
if [remove global text engine resource]; otherwise, false
.public boolean isRefreshImagePreviewData()
Gets a value indicating whether [refresh image preview data] - option used to maximize compatibility with another PSD image viewers.
true
if [refresh image preview data]; otherwise, false
.public void setRefreshImagePreviewData(boolean value)
Sets a value indicating whether [refresh image preview data] - option used to maximize compatibility with another PSD image viewers.
value
- true
if [refresh image preview data]; otherwise, false
.public final PsdVectorizationOptions getVectorizationOptions()
Gets the PSD vectorization options.
public final void setVectorizationOptions(PsdVectorizationOptions value)
Sets the PSD vectorization options.
value
- the PSD vectorization options.