PsdLoadOptions.ReadOnlyType
Contents
[
Hide
]PsdLoadOptions.ReadOnlyType property
Gets or sets the read-only mode used when loading a PSD image.
public ReadOnlyMode ReadOnlyType { get; set; }
Property Value
One of the ReadOnlyMode values:
- !:ReadOnlyMode.None – No restrictions. Image content can be modified.
- !:ReadOnlyMode.Default – The image is fully read-only.
- !:ReadOnlyMode.MetadataEdit – Only metadata can be edited (such as
ImageResources), while image pixel content remains read-only.
Examples
Demonstrates editing and saving PSD metadata using ReadOnlyMode.MetadataEdit.
[C#]
string sourceFile = "psdnet2382.psd";
string outputFile = "output.psd";
string testMetadata = "Updated metadata text";
using (PsdImage psdImage = (PsdImage)Aspose.PSD.Image.Load(sourceFile,
new PsdLoadOptions() { ReadOnlyType = ReadOnlyMode.MetadataEdit })) // Sets the of ReadOnlyMode to true
{
AssertAreNotEqual(testMetadata, psdImage.XmpData.Meta.AdobeXmpToolkit);
// Change metadata in ReadOnlyMode
psdImage.XmpData.Meta.AdobeXmpToolkit = testMetadata;
// Save changed metadata in ReadOnlyMode
psdImage.Save(outputFile);
}
using (PsdImage psdImage = (PsdImage)Aspose.PSD.Image.Load(outputFile)) // Sets the of ReadOnlyMode to true
{
AssertAreEqual(testMetadata, psdImage.XmpData.Meta.AdobeXmpToolkit);
}
void AssertAreEqual(object expected, object actual)
{
if (!object.Equals(expected, actual))
{
throw new Exception("Objects should be equal, but they don't.");
}
}
void AssertAreNotEqual(object obj1, object obj2)
{
if (object.Equals(obj1, obj2))
{
throw new Exception("Objects should not be equal, but they are equal.");
}
}
See Also
- enum ReadOnlyMode
- class PsdLoadOptions
- namespace Aspose.PSD.ImageLoadOptions
- assembly Aspose.PSD