Welcome Guest! To enable all features, please Login or Register.



Last Go to last post Unread Go to first unread post
#1 Posted : Monday, June 5, 2017 8:47:35 AM(UTC)


Groups: Registered, Tech Support, Administrators
Posts: 39

Thanks: 2 times
Was thanked: 3 time(s) in 3 post(s)

If you have a need to automatically detect the color type of input files in your application you could write a routine that looks at individual pixel color values and iterate through each pixel row by row, coloumn by column but who has time for that. Instead, you can use the LEADTOOLS ImageColorTypeCommand. The following code snippet will return the detected image color type and the associated confidence.
public void detectColorType()
   using (RasterCodecs codecs = new RasterCodecs())
      RasterImage image = codecs.Load(@"PATH TO IMAGE FILE");
      ImageColorTypeCommand command = new ImageColorTypeCommand();
      Console.WriteLine($"Color Type: {command.ColorType}\nConfidence: {command.Confidence}");

The output from this code will be an ImageColorType (Color, BlackAndWhite, GrayScale or none).
Roberto Rodriguez
Developer Support Engineer
LEAD Technologies, Inc.


Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Friday, August 31, 2018 8:47:37 AM(UTC)
Christopher Thompson

Groups: Tech Support, Administrators
Posts: 60

Was thanked: 2 time(s) in 2 post(s)

ColorTypeCommand from v20 LEADTOOLS Online Documentation.

Attached is a fully functioning sample application that utilizes the code snippet provided from the post above.
The project uses the LEADTOOLS v20 SDK.

The Leadtools.Pdf.dll is included to work with PDF files. Other Codices may need to be added to work with the various types of file formats that LEADTOOLS Supports.

File Attachment(s):
simpleDetectColor_20.zip (194kb) downloaded 193 time(s).
Chris Thompson
Developer Support Engineer
LEAD Technologies, Inc.

You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2019, Yet Another Forum.NET
This page was generated in 0.095 seconds.