Determines whether the specified bits per pixel value supported by LEADTOOLS is compatible with GDI+.
public static bool IsValidBitsPerPixel(int bitsPerPixel)
Public Shared Function IsValidBitsPerPixel( _ByVal bitsPerPixel As Integer _) As Boolean
public:static bool IsValidBitsPerPixel(int bitsPerPixel)
bitsPerPixel
The input bits per pixel value.
true if bitsPerPixel is compatible with GDI+, otherwise it is false.
For more information refer to RasterImage and GDI/GDI+.
Imports LeadtoolsImports Leadtools.CodecsImports Leadtools.DrawingImports Leadtools.ImageProcessingImports Leadtools.ImageProcessing.Color<TestMethod()> _Public Sub IsValidBitsPerPixelExample()Dim codecs As New RasterCodecs()Using image As RasterImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp"))' check if this image has a valid gdi plus bits/pixel. It should say trueIf RasterImageConverter.IsValidBitsPerPixel(image.BitsPerPixel) ThenConsole.WriteLine(String.Format("{0} is a valid GDI+ bits/pixel", image.BitsPerPixel))ElseConsole.WriteLine(String.Format("{0} is not a valid GDI+ bits/pixel", image.BitsPerPixel))End If' change this image to grayscale 12-bitDim cmd As New ColorResolutionCommand( _ColorResolutionCommandMode.InPlace, _12, _RasterByteOrder.Gray, _RasterDitheringMethod.None, _ColorResolutionCommandPaletteFlags.Optimized, _Nothing)cmd.Run(image)' check if this image has a valid gdi plus bits/pixel. It should say falseIf RasterImageConverter.IsValidBitsPerPixel(image.BitsPerPixel) ThenConsole.WriteLine(String.Format("{0} is a valid GDI+ bits/pixel", image.BitsPerPixel))ElseConsole.WriteLine(String.Format("{0} is not a valid GDI+ bits/pixel", image.BitsPerPixel))End IfEnd Usingcodecs.Dispose()End SubPublic NotInheritable Class LEAD_VARSPublic Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"End Class
using Leadtools;using Leadtools.Codecs;using Leadtools.Drawing;using Leadtools.ImageProcessing;using Leadtools.ImageProcessing.Color;public void IsValidBitsPerPixelExample(){RasterCodecs codecs = new RasterCodecs();using(RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp"))){// check if this image has a valid gdi plus bits/pixel. It should say trueif(RasterImageConverter.IsValidBitsPerPixel(image.BitsPerPixel)){Console.WriteLine(string.Format("{0} is a valid GDI+ bits/pixel", image.BitsPerPixel));}else{Console.WriteLine(string.Format("{0} is not a valid GDI+ bits/pixel", image.BitsPerPixel));}// change this image to grayscale 12-bitColorResolutionCommand cmd = new ColorResolutionCommand(ColorResolutionCommandMode.InPlace,12,RasterByteOrder.Gray,RasterDitheringMethod.None,ColorResolutionCommandPaletteFlags.Optimized,null);cmd.Run(image);// check if this image has a valid gdi plus bits/pixel. It should say falseif(RasterImageConverter.IsValidBitsPerPixel(image.BitsPerPixel)){Console.WriteLine(string.Format("{0} is a valid GDI+ bits/pixel", image.BitsPerPixel));}else{Console.WriteLine(string.Format("{0} is not a valid GDI+ bits/pixel", image.BitsPerPixel));}}codecs.Dispose();}static class LEAD_VARS{public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";}
|
Products |
Support |
Feedback: IsValidBitsPerPixel Method - Leadtools.Drawing |
Introduction |
Help Version 19.0.2017.3.21
|

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.