Class LoadOptions
Namespace: Aspose.Imaging
Assembly: Aspose.Imaging.dll (25.2.0)
Represents the loading options.
[JsonObject(MemberSerialization.OptIn)]
public class LoadOptions
Inheritance
Derived
CdrLoadOptions, CmxLoadOptions, DngLoadOptions, EpsLoadOptions, Jpeg2000LoadOptions, OdLoadOptions, PngLoadOptions, SvgLoadOptions
Inherited Members
object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Constructors
LoadOptions()
[JsonConstructor]
public LoadOptions()
Properties
BufferSizeHint
Gets or sets the buffer size hint which is defined max allowed size for all internal buffers.
public int BufferSizeHint { get; set; }
Property Value
Examples
The following example shows how to set a memory limit when loading a CMX image. The memory limit is the maximum allowed size (in megabytes) for all internal buffers.```csharp [C#]
string dir = "c:\\aspose.imaging\\issues\\net\\3419\\";
// Setting a memory limit of 10 megabytes for a target loaded image.
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "example.cmx", new Aspose.Imaging.LoadOptions() { BufferSizeHint = 10 }))
{
image.Save(dir + "output.png",
new Aspose.Imaging.ImageOptions.PngOptions()
{
VectorRasterizationOptions =
new Aspose.Imaging.ImageOptions.CmxRasterizationOptions
{
TextRenderingHint = Aspose.Imaging.TextRenderingHint.SingleBitPerPixel,
SmoothingMode = Aspose.Imaging.SmoothingMode.AntiAlias,
Positioning = Aspose.Imaging.ImageOptions.PositioningTypes.DefinedByDocument
}
});
}
The following example shows how to set a memory limit when loading a JPEG image. The memory limit is the maximum allowed size (in megabytes) for all internal buffers.```csharp
[C#]
string dir = "c:\\aspose.imaging\\issues\\net\\3404\\";
// Setting a memory limit of 50 megabytes for target loaded image
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "inputFile.jpg", new Aspose.Imaging.LoadOptions() { BufferSizeHint = 50 }))
{
image.Save(dir + "outputFile_Baseline.jpg",
new Aspose.Imaging.ImageOptions.JpegOptions
{
CompressionType = Aspose.Imaging.FileFormats.Jpeg.JpegCompressionMode.Baseline,
Quality = 100
});
image.Save(dir + "outputFile_Progressive.jpg",
new Aspose.Imaging.ImageOptions.JpegOptions
{
CompressionType = Aspose.Imaging.FileFormats.Jpeg.JpegCompressionMode.Progressive
});
image.Save(dir + "outputFile_Lossless.jpg",
new Aspose.Imaging.ImageOptions.JpegOptions
{
ColorType = Aspose.Imaging.FileFormats.Jpeg.JpegCompressionColorMode.YCbCr,
CompressionType = Aspose.Imaging.FileFormats.Jpeg.JpegCompressionMode.Lossless,
BitsPerChannel = 4
});
image.Save(dir + "outputFile_JpegLs.jpg",
new Aspose.Imaging.ImageOptions.JpegOptions
{
ColorType = Aspose.Imaging.FileFormats.Jpeg.JpegCompressionColorMode.YCbCr,
CompressionType = Aspose.Imaging.FileFormats.Jpeg.JpegCompressionMode.JpegLs,
JpegLsInterleaveMode = Aspose.Imaging.FileFormats.Jpeg.JpegLsInterleaveMode.None,
JpegLsAllowedLossyError = 3,
JpegLsPreset = null
});
}
ConcurrentImageProcessing
Gets or sets a value indicating whether [concurrent image processing].
public bool ConcurrentImageProcessing { get; set; }
Property Value
DataBackgroundColor
Gets or sets the Aspose.Imaging.Image background Aspose.Imaging.Color.
public Color DataBackgroundColor { get; set; }
Property Value
Remarks
Typically the background color is set whenever pixel value cannot be recovered due to data corruption.
DataRecoveryMode
Gets or sets the data recovery mode.
public DataRecoveryMode DataRecoveryMode { get; set; }
Property Value
ProgressEventHandler
Gets or sets the progress event handler.
[JsonProperty]
public ProgressEventHandler ProgressEventHandler { get; set; }
Property Value
Examples
The following example shows how to print information about progress events for load/export operations.```csharp [C#]
public void Test3460()
{
string dir = "c:\\aspose.imaging\\net\\issues\\3460";
string fileName = System.IO.Path.Combine(dir, "big.png");
// Example of use of separate operation progress event handlers for load/export operations
using (var image = Aspose.Imaging.Image.Load(fileName, new Aspose.Imaging.LoadOptions { ProgressEventHandler = ProgressCallback }))
{
image.Save(fileName + ".psd",
new Aspose.Imaging.ImageOptions.PsdOptions() { ProgressEventHandler = ExportProgressCallback });
}
}
private void ProgressCallback(Aspose.Imaging.ProgressManagement.ProgressEventHandlerInfo info)
{
System.Console.WriteLine("{0} : {1}/{2}", info.EventType, info.Value, info.MaxValue);
}
private void ExportProgressCallback(Aspose.Imaging.ProgressManagement.ProgressEventHandlerInfo info)
{
System.Console.WriteLine("Export event {0} : {1}/{2}", info.EventType, info.Value, info.MaxValue);
}
// The STDOUT log may look like this:
//Initialization : 1/4
//PreProcessing : 2/4
//Processing : 3/4
//Finalization : 4/4
//Export event Initialization : 1/4
//Export event PreProcessing : 2/4
//Export event Processing : 3/4
//Export event RelativeProgress : 1/1
//RelativeProgress : 1/1
//Export event Finalization : 4/4
### <a id="Aspose_Imaging_LoadOptions_UseIccProfileConversion"></a> UseIccProfileConversion
Gets or sets a value indicating whether ICC profile conversion should be applied.
```csharp
[Obsolete("ICC profile conversion will be used by default and this property will be removed.")]
public bool UseIccProfileConversion { get; set; }
Property Value
Methods
AddCustomFontSource(CustomFontSource, params object[])
Adds the custom font source to supply image-specific fonts.
public void AddCustomFontSource(CustomFontSource source, params object[] args)
Parameters
source
CustomFontSource
The custom font source provider function.
args
object[]
The arguments.