Encodes the input raw data using the ABIC encoder.
Public Overloads Function EncodeAbic( _ByVal inputData() As Byte, _ByVal align As Integer, _ByVal width As Integer, _ByVal height As Integer, _ByVal biLevel As Boolean _) As Byte()
public:array<byte>^ EncodeAbic(array<byte>^ inputData,int align,int width,int height,bool biLevel)
inputData
A byte array which contains the input data.
align
Number of bytes aligned for uncompressed input data.
width
Image width, in pixels.
height
Image height, in pixels.
biLevel
true to indicate bi-level encoding, false to indicate 4-bit grayscale encoding.
A byte array that contains the ABIC encoded data.
Call this method to compress the input raw data to 1-bit bi-level or 4-bit grayscale ABIC data.
Use DecodeAbic to decode ABIC data.
This example will load a file and encode as as ABIC. Decodes the data again before saving it to a destination file
using Leadtools;using Leadtools.Codecs;using Leadtools.ImageProcessing;using Leadtools.ImageProcessing.Color;using Leadtools.Svg;using LeadtoolsExamples.Common;public void EncodeDecodeAbicExample(){RasterCodecs codecs = new RasterCodecs();string srcFileName = Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp");string destDataFile = Path.Combine(LEAD_VARS.ImagesDir, "Image1_Abic.bmp");// Load the file save it to a memory stream as RAWConsole.WriteLine("Loading the source image as 1 bits/pixel");RasterImage srcImage = codecs.Load(srcFileName, 1, CodecsLoadByteOrder.Rgb, 1, 1);Console.WriteLine("Saving the image to memory as RAW format");MemoryStream ms = new MemoryStream();codecs.Save(srcImage, ms, RasterImageFormat.Raw, srcImage.BitsPerPixel);Console.WriteLine("Encoding the data as ABIC");byte[] rawData = ms.GetBuffer();ms.Close();// Encode this data as ABICbyte[] abicData = codecs.EncodeAbic(rawData, 4, srcImage.Width, srcImage.Height, false);// Decode the data back to RAWConsole.WriteLine("Deconding the data back as RAW");rawData = codecs.DecodeAbic(abicData, 4, srcImage.Width, srcImage.Height, false);// Create a new image from this dataRasterImage destImage = new RasterImage(RasterMemoryFlags.Conventional,srcImage.Width,srcImage.Height,srcImage.BitsPerPixel,srcImage.Order,srcImage.ViewPerspective,srcImage.GetPalette(),IntPtr.Zero,0);// Add the scan linesfor (int y = 0; y < destImage.Height; y++){int bufferIndex = y * destImage.BytesPerLine;destImage.SetRow(y, rawData, bufferIndex, destImage.BytesPerLine);}// Save this image to diskcodecs.Save(destImage, destDataFile, RasterImageFormat.Bmp, destImage.BitsPerPixel);srcImage.Dispose();destImage.Dispose();// Clean upcodecs.Dispose();}static class LEAD_VARS{public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";}
Imports LeadtoolsImports Leadtools.CodecsImports Leadtools.ImageProcessingImports Leadtools.ImageProcessing.ColorImports Leadtools.DrawingImports Leadtools.SvgPublic Sub EncodeDecodeAbicExample()Dim codecs As RasterCodecs = New RasterCodecs()Dim srcFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp")Dim destDataFile As String = Path.Combine(LEAD_VARS.ImagesDir, "Image1_Abic.bmp")' Load the file save it to a memory stream as RAWConsole.WriteLine("Loading the source image as 1 bits/pixel")Dim srcImage As RasterImage = codecs.Load(srcFileName, 1, CodecsLoadByteOrder.Rgb, 1, 1)Console.WriteLine("Saving the image to memory as RAW format")Dim ms As MemoryStream = New MemoryStream()codecs.Save(srcImage, ms, RasterImageFormat.Raw, srcImage.BitsPerPixel)Console.WriteLine("Encoding the data as ABIC")Dim rawData As Byte() = ms.GetBuffer()ms.Close()' Encode this data as ABICDim abicData As Byte() = codecs.EncodeAbic(rawData, 4, srcImage.Width, srcImage.Height, False)' Decode the data back to RAWConsole.WriteLine("Deconding the data back as RAW")rawData = codecs.DecodeAbic(abicData, 4, srcImage.Width, srcImage.Height, False)' Create a new image from this dataDim destImage As RasterImage = New RasterImage(RasterMemoryFlags.Conventional, srcImage.Width, srcImage.Height, srcImage.BitsPerPixel, srcImage.Order, srcImage.ViewPerspective, srcImage.GetPalette(), IntPtr.Zero, 0)' Add the scan linesDim y As Integer = 0Do While y < destImage.HeightDim bufferIndex As Integer = y * destImage.BytesPerLinedestImage.SetRow(y, rawData, bufferIndex, destImage.BytesPerLine)y += 1Loop' Save this image to diskcodecs.Save(destImage, destDataFile, RasterImageFormat.Bmp, destImage.BitsPerPixel)srcImage.Dispose()destImage.Dispose()' Clean upcodecs.Dispose()End SubPublic NotInheritable Class LEAD_VARSPublic Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"End Class
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
