public bool Reverse { get; set; } @property (nonatomic, assign) BOOL reverse; public boolean getReverse()public void setReverse(boolean value)
Reverse # get and set (CodecsLoadInformationEventArgs)
true if each line is reversed (mirrored); false, otherwise.
using Leadtools;using Leadtools.Codecs;using Leadtools.ImageProcessing;using Leadtools.ImageProcessing.Color;using Leadtools.Svg;private struct RawData{public int Width; // Width of imagepublic int Height; // Height of imagepublic int BitsPerPixel; // Bits per pixel of image--if palettized, a gray palette is generatedpublic RasterViewPerspective ViewPerspective; // View perspective of raw data (TopLeft, BottomLeft, etc)public RasterByteOrder Order; // Rgb or Bgrpublic int XResolution; // Horizontal resolution in DPIpublic int YResolution; // Vertical resolution in DPIpublic int Offset; // Offset into file where raw data beginspublic bool Padding; // true if each line of data is padded to four bytespublic bool ReverseBits; // true if the bits of each byte are reversed}private RawData myRawData;private void codecs_LoadInformation(object sender, CodecsLoadInformationEventArgs e){// Set the informatione.Format = RasterImageFormat.Raw;e.Width = myRawData.Width;e.Height = myRawData.Height;e.BitsPerPixel = myRawData.BitsPerPixel;e.XResolution = myRawData.XResolution;e.YResolution = myRawData.YResolution;e.Offset = myRawData.Offset;e.MotorolaOrder = false;e.PhotoInterpolation = CodecsPhotoInterpolation.WhiteIsZero;e.PlanarConfiguration = CodecsPlanarConfiguration.PlanarFormat; // This value is used only if Format is RasterImageFormat.RawPackBitse.Reverse = true;e.StripSize = 10;e.WhiteOnBlack = false;e.GetPalette();Debug.WriteLine($"Stream: {e.Stream.ToString()}");if (myRawData.Padding)e.Pad4 = true;e.Order = myRawData.Order;if (myRawData.ReverseBits)e.LeastSignificantBitFirst = true;e.ViewPerspective = myRawData.ViewPerspective;// If image is palettized create a grayscale paletteif (e.BitsPerPixel <= 8){int colors = 1 << e.BitsPerPixel;RasterColor[] palette = new RasterColor[colors];for (int i = 0; i < palette.Length; i++){byte val = (byte)((i * 255) / (colors - 1));palette[i] = new RasterColor(val, val, val);}e.SetColorMask(palette);e.SetPalette(palette);}}public void LoadInformationExample(){// First, load a JPEG or CMP filestring srcFilename = Path.Combine(LEAD_VARS.ImagesDir, "IMAGE2.CMP");string rawFileName = Path.Combine(LEAD_VARS.ImagesDir, "Image1.raw");RasterCodecs codecs = new RasterCodecs();RasterImage image = codecs.Load(srcFilename);// Save this image as RAW data// Set RAW optionscodecs.Options.Raw.Save.Pad4 = true;codecs.Options.Raw.Save.ReverseBits = true;codecs.Options.Save.OptimizedPalette = true;codecs.Save(image, rawFileName, RasterImageFormat.Raw, 0);// Save information about this image so we can use it to load the RAW filemyRawData = new RawData();myRawData.Width = image.Width;myRawData.Height = image.Height;myRawData.BitsPerPixel = image.BitsPerPixel;myRawData.ViewPerspective = image.ViewPerspective;myRawData.Order = image.Order;myRawData.XResolution = image.XResolution;myRawData.YResolution = image.YResolution;myRawData.Offset = 0;myRawData.Padding = true;myRawData.ReverseBits = true;// We dont need the image anymoreimage.Dispose();// Now load this RAW image back// First subscribe to the LoadInformation event so we can set the image informationcodecs.LoadInformation += new EventHandler<CodecsLoadInformationEventArgs>(codecs_LoadInformation);// Load the imageimage = codecs.Load(rawFileName);// Unsubscribe from the eventcodecs.LoadInformation -= new EventHandler<CodecsLoadInformationEventArgs>(codecs_LoadInformation);// save it as bmp for testingcodecs.Save(image, Path.Combine(LEAD_VARS.ImagesDir, "Image1_raw.bmp"), RasterImageFormat.Bmp, 0);// Clean upimage.Dispose();codecs.Dispose();}static class LEAD_VARS{public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images";}
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
