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(PsdImage image)
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.
|
ResourceBlock[] |
getResources()
Gets or sets the psd resources.
|
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 |
setResources(ResourceBlock[] value)
Gets or sets the psd resources.
|
void |
setVersion(int value)
Gets or sets the psd file version.
|
void |
setXmpData(XmpPacketWrapper value)
Get or set XMP data container
|
deepClone, getBufferSizeHint, getMultiPageOptions, getPalette, getProgressEventHandler, getResolutionSettings, getSource, getVectorRasterizationOptions, setBufferSizeHint, 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 PsdOptions(PsdImage image)
Initializes a new instance of the PsdOptions
class.
image
- The image.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 ResourceBlock[] getResources()
Gets or sets the psd resources.
Value: The psd resources.public void setResources(ResourceBlock[] value)
Gets or sets the psd resources.
Value: The psd resources.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(com.aspose.imaging.fileformats.psd.PsdImage.DEFAULT_VERSION); // Define a custom name for alpha channel com.aspose.imaging.fileformats.psd.resources.UnicodeAlphaNamesResource alphaNames = new com.aspose.imaging.fileformats.psd.resources.UnicodeAlphaNamesResource(); alphaNames.setAlphaNames("The Alpha Channel"); // Set the custom name for alpha channel saveOptions.setResources(new com.aspose.imaging.fileformats.psd.ResourceBlock[]{alphaNames}); 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 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(com.aspose.imaging.fileformats.psd.PsdImage.DEFAULT_VERSION); // Define a custom name for alpha channel com.aspose.imaging.fileformats.psd.resources.UnicodeAlphaNamesResource alphaNames = new com.aspose.imaging.fileformats.psd.resources.UnicodeAlphaNamesResource(); alphaNames.setAlphaNames("The Alpha Channel"); // Set the custom name for alpha channel saveOptions.setResources(new com.aspose.imaging.fileformats.psd.ResourceBlock[]{alphaNames}); 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(com.aspose.imaging.fileformats.psd.PsdImage.DEFAULT_VERSION); // Define a custom name for alpha channel com.aspose.imaging.fileformats.psd.resources.UnicodeAlphaNamesResource alphaNames = new com.aspose.imaging.fileformats.psd.resources.UnicodeAlphaNamesResource(); alphaNames.setAlphaNames("The Alpha Channel"); // Set the custom name for alpha channel saveOptions.setResources(new com.aspose.imaging.fileformats.psd.ResourceBlock[]{alphaNames}); 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(com.aspose.imaging.fileformats.psd.PsdImage.DEFAULT_VERSION); // Define a custom name for alpha channel com.aspose.imaging.fileformats.psd.resources.UnicodeAlphaNamesResource alphaNames = new com.aspose.imaging.fileformats.psd.resources.UnicodeAlphaNamesResource(); alphaNames.setAlphaNames("The Alpha Channel"); // Set the custom name for alpha channel saveOptions.setResources(new com.aspose.imaging.fileformats.psd.ResourceBlock[]{alphaNames}); 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
.