ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Detect whether page is monochrome
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

mwilliams

United Kingdom
9 Posts

Posted - Aug 23 2017 :  12:57:43  Show Profile  Reply
I have an app which can be required to upload thousands of pages of documents to a document server. To reduce the amount of time involved in uploading and to reduce the required size of the server, I have tried to write a function which determines whether the relevant pages are monochrome text documents or rather can they be satisfactorily treated as monochrome and thereby saved in a lower quality tiff format rather than jpeg.

The code I have developed so far is not terribly accurate (to say the least). What I am looking for is a function which is commonly found on scanners, whereby they automatically detect whether or not a page needs to be saved in colour.

Is there a function within ImageEn for doing this or, if not, is there one in IEVision?

Thanks

xequte

38186 Posts

Posted - Aug 23 2017 :  22:35:35  Show Profile  Reply
Hi

Have you tried Proc.CalcImageNumColors?

https://www.imageen.com/help/TImageEnProc.CalcImageNumColors.html

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

shackers

United Kingdom
28 Posts

Posted - Sep 29 2020 :  06:05:13  Show Profile  Reply
Long time responding to this post! Sorry.

What I need is a function which can determine if it is safe to treat a document as if it is monochrome. If so I am saving it as a basic monochrome tiff to maximize size reduction.

I know that some scanners provide a similar function and perform an educated guess as to whether a document needs to be saved as colour or monochrome. So, for example, they may treat a document as monochrome where it has a single band of colour along the top.

I have had a bit of a play with CalcImageNumColors, submitting some out monochtrome text files, grayscale photos and colour photos.

The text files produced results of 256 colours or lower.
The grayscale images 30,000 colours or over
The colour images 140,000 colours or over.

I am thinking that a sensible approach may be to treat anything under 1000 colours as monochrome. Would you agree with that?

Many thanks.



Go to Top of Page

xequte

38186 Posts

Posted - Sep 30 2020 :  03:08:34  Show Profile  Reply
OK, that seems reasonable. Though, naturally, you will still get some quality loss when downscaling an image with hundreds of gray levels to just black and white.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

shackers

United Kingdom
28 Posts

Posted - Sep 30 2020 :  03:35:24  Show Profile  Reply
OK. Thanks. Perhaps I'll play a little more with it to fine tune.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: