Loading and Saving Images - Namespace - Raster, Medical, Document Help

Loading and Saving Images

Powerful, but Easy to Use

LEADTOOLS provides many options when loading and saving image files. Nevertheless, the code can be as simple as the following, which loads a LEAD compressed file and saves it as a Windows BMP file:

C#
VB
Java
// Create a new instance of the RasterCodecs class 
Leadtools.Codecs.RasterCodecs codecs = new Leadtools.Codecs.RasterCodecs(); 
// Load an image at its own bits per pixel 
Leadtools.RasterImage image = codecs.Load(@"Test.cmp",0,Leadtools.Codecs.CodecsLoadByteOrder.Bgr,1,1); 
// Save the image as a 24-bit Windows BMP file 
codecs.Save(image,@"Test.bmp",Leadtools.RasterImageFormat.Bmp,24,1,1,1,Leadtools.Codecs.CodecsSavePageMode.Overwrite); 
// Dispose of the objects we created 
image.Dispose(); 
codecs.Dispose(); 

' Create a new instance of the RasterCodecs class 
Dim codecs As New Leadtools.Codecs.RasterCodecs() 
' Load an image at its own bits per pixel 
Dim image As Leadtools.RasterImage = codecs.Load("Test.cmp",0,Leadtools.Codecs.CodecsLoadByteOrder.Bgr,1,1) 
' Save the image as a 24-bit Windows BMP file 
codecs.Save(image,"Test.bmp",Leadtools.RasterImageFormat.Bmp,24,1,1,1,Leadtools.Codecs.CodecsSavePageMode.Overwrite) 
' Dispose of the objects we created 
image.Dispose() 
codecs.Dispose() 

// Create a new instance of the RasterCodecs class  
leadtools.codecs.RasterCodecs codecs = new leadtools.codecs.RasterCodecs(); 
// Load an image at its own bits per pixel 
leadtools.RasterImage image = codecs.load("Test.cmp",0,leadtools.codecs.CodecsLoadByteOrder.BGR,1,1); 
// Save the image as a 24-bit Windows BMP file 
codecs.save(image,"Test.bmp",leadtools.RasterImageFormat.BMP,24,1,1,1,leadtools.codecs.CodecsSavePageMode.OVERWRITE); 
// Dispose of the objects we created  
image.dispose(); 
codecs.dispose(); 

The following table describes some of the capabilities available when loading and saving images:

Feature Description

References

Help Version 20.0.2018.8.13
Products | Support | Contact Us | Copyright Notices
© 1991-2018 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Imaging, Medical, and Document