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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Inverted Colors, Multiple Pages

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
Ken Posted - Aug 09 2011 : 11:17:42
ImageEn 3.1.2, D7

My scanner is producing images with inverted colors (white on black). I understand that this is ultimately a scanner or driver problem. But I'd like to be able to scan multiple pages, and invert the colors on all pages automatically if it looks like the colors are inverted (if black pixels are more common than white ones).

This is what I have so far, after the scanning:

for i := 1 to MyTImageEnMView.ImageCount do
begin
MyTImageEnMView.SelectedImage := i;
MyTImageEnMView.Proc.GetDominantColor(RGB);
if RGB.B = 0 then
MyTImageEnMView.Proc.Negative;
MyTImageEnMView.GetImageToFile(...);
end;


This is giving me erratic results. Some images wind up black on white, and some don't. I'm not sure that SelectedImage and Proc are working well together. Any ideas?

Thanks,

Ken
1   L A T E S T    R E P L I E S    (Newest First)
fab Posted - Aug 09 2011 : 14:00:23
Hello,
first let me say that indexes starts from 0 up to ImageCount-1, so your loop should be:

for i := 0 to MyTImageEnMView.ImageCount-1 do
...etc...

What I actually don't understand is if GetDominantColor() return value is not good for this purpose, or if Proc.Negative fail to make the image negative. Please let me know.