Indicates the beginning of a section of code using the same source file.
public void StartOptimizedLoad()
Public Sub StartOptimizedLoad()
public void StartOptimizedLoad()
function Leadtools.Codecs.RasterCodecs.StartOptimizedLoad()
public:
void StartOptimizedLoad();
Optimizes the load or conversion from a file with multiple pages. Call this method before a loop that involves loading from the same source file. Call StopOptimizedLoad when finished.
This method should be used only if the source file is the same and its contents is unchanged.
This method can greatly speed up a loop involving multiple GetInformation, Load or Convert methods for certain formats (for example, PDF files).
For more information, refer to Using the OptimizedLoad Functions to Speed Loading Large Files.
using Leadtools;
using Leadtools.Codecs;
using Leadtools.ImageProcessing;
using Leadtools.ImageProcessing.Color;
using Leadtools.Svg;
using LeadtoolsExamples.Common;
public void OptimizedLoadExample()
{
using (RasterCodecs codecs = new RasterCodecs())
{
// The speed improvement is most noticeable in source files with many pages
string srcFileName = Path.Combine(LEAD_VARS.ImagesDir, "MultiPage.pdf");
// indicate the start of a loop from the same source file
codecs.StartOptimizedLoad();
for (int i = 1; i < 10; i++)
{
using (RasterImage image = codecs.Load(srcFileName, i))
{
string destFileName = Path.Combine(LEAD_VARS.ImagesDir, "out_" + i.ToString() + ".jpg");
// Save as the destination image
codecs.Save(image, destFileName, RasterImageFormat.Jpeg411, 24);
}
}
// Indicate that I finished using the same source file.
codecs.StopOptimizedLoad();
}
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";
}
Imports Leadtools
Imports Leadtools.Codecs
Imports Leadtools.ImageProcessing
Imports Leadtools.ImageProcessing.Color
Imports Leadtools.Drawing
Imports Leadtools.Svg
Public Sub OptimizedLoadExample()
Using codecs As RasterCodecs = New RasterCodecs()
' The speed improvement is most noticeable in source files with many pages
Dim srcFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "MultiPage.pdf")
' indicate the start of a loop from the same source file
codecs.StartOptimizedLoad()
For i As Integer = 1 To 10
Using image As RasterImage = codecs.Load(srcFileName, i)
Dim destFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "out_" + i.ToString() + ".jpg")
' Save as the destination image
codecs.Save(image, destFileName, RasterImageFormat.Jpeg411, 24)
End Using
Next
' Indicate that I finished using the same source file.
codecs.StopOptimizedLoad()
End Using
End Sub
Public NotInheritable Class LEAD_VARS
Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"
End Class
Products |
Support |
Feedback: StartOptimizedLoad Method - Leadtools.Codecs |
Introduction |
Help Version 19.0.2017.6.16
|
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.