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?
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.