Transform a scanned musical score image to (hard) black and white

Discuss and share Pixelmator Pro resources such as templates, mockups, and tutorials.
User avatar

2022-10-17 14:43:33

Hi,

I guess there should a more or less standard solution for this, so as a newbie I do not want to reinvent the wheel: what is the best way to transform a (black and white) musical score scanned in color or grey scale to "real" (hard) black and white?

The sources I have are mostly color scans from scores printed black on a white background. Since many of them are mobile phone scans etc., the images have lots of grey scale shadows which I'd like to remove to recreate the original black on white image.

Sometimes there are color scans of oldish (and therefore over the years turned brownish) paper, printed in black. Ideally, I'd like to see a background in white with the printed text in black with the highest possible contrast.

I realize that Pixelmator has a black and white filter as well as ML Enhance which is already quite good but still is returns a grey scale image where I'd ideally like to have plain black and white, or at least as close as possible.

I suppose it should be necessary to set some kind of threshold for black and white for every type of scan / batch of images scanned under identical conditions, but other than that I'd hope to automatize this process with a basic preset which has to be tweaked only minimally for each usage case (I do have a longterm knowledge of (advanced) AppleScript, but neiter do I know about possible potentially complex batch processing features in Pixelmator, nor about Pixelmators scripting potential, at least not yet).

So my question has two parts:

(a) What is the ideal method of filtering?
(b) How can I save and reuse this filter?

I should have added that I have experimented a lot, i. e. using the B/W filter and tweaking saturation and exposure already gives quite good results, but I could not find a way to replace the background altogether, i. e. to leave only black parts above a certain saturation level on the page and remove any greys below that level as well as remove and/or replace any remants of non-black (any other color) by white.

Thanks for any pointers!
User avatar

2022-10-18 10:26:57

I am adding a sample image:

Image

What I can come up with is this:

Image

Which is really not bad, but it is grey scale, and not really B/W.

And of course, there a worse samples with all kinds of dirty spots, uneven light resulting in shadows and so on.

I dunno, maybe this is simply not possible.
But in theory, "keep all the black above saturation X and throw away the rest" should be possible, shouldn't it?

Thanks again!
User avatar

2022-10-20 10:04:47

Regarding the resolution I´d suggest to download the JPGs- not the PDF/tiff variant.
I´d added 3d Adjustment layers to Replace colors (select dark/mid/light grey - to replace with white) after cropping the image. Slight curves adjustment to get a better contrast.
Not sure if that fits your needs already:
Image
Image
User avatar

2022-10-20 10:25:19

Wow, OK, these are the little tricks of trade I have to learn.

Yes, this looks very, very good indeed.

For my understanding: Your source image was my original source, hopefully, not my already tampered image?
Then, why prefer JPEG over tiff?

Finally, I'd be very happy if you could somehow provide me with your Pixelmator project file, so I can study what you did. :blush:

Your result is indeed far better than any result of my various experiments.

Thank you very much!
by EllenM Regarding the resolution I´d suggest to download the JPGs- not the PDF/tiff variant.
I´d added 3d Adjustment layers to Replace colors (select dark/mid/light grey - to replace with white) after cropping the image. Slight curves adjustment to get a better contrast.
Not sure if that fits your needs already:
User avatar

2022-10-20 11:07:15

I've been at the source URL and downloaded the jpg because of the provided higher resolution. Sure you can have my file, we just need to figure how we can share the file. But it's almost displayed in the screenshot above.
1. Color Adjustment is just Replace Color
2.+3. Color Adjustments are Replace Color plus Curves slightly adjusted to match the histogram.
User avatar

2022-10-20 11:34:22

OK, thank you very much.

You could send me the .pxd file (not only the improved image, since I want to see exactly what and how you did it :smiley: ) to this throw-away e-mail address: XXX@somthing.de. I will delete it afterwards.

I do not want to get on your nerves :blush: but why do you prefer the jpg?

Thanks a lot for your very much appreciated help!

Peter
by EllenM I've been at the source URL and downloaded the jpg because of the provided higher resolution. Sure you can have my file, we just need to figure how we can share the file. But it's almost displayed in the screenshot above.
1. Color Adjustment is just Replace Color
2.+3. Color Adjustments are Replace Color plus Curves slightly adjusted to match the histogram.
User avatar

2022-10-20 11:45:13

Noticed your email - so please take it down to prevent you from spam.
The downloaded Jpg has a higher resolution - no?
I'll send you the file when back@Mac in about 6hs.
User avatar

2022-10-20 11:53:44

Thanks, great. Of course I will delete this adress once I receive your mail - no problem. I could also edit my post, additionally.

Thanks again, Peter
by EllenM Noticed you email - so please take it down to prevent you from spam.
The downloaded Jpg has a higher resolution - no?
I'll send you the file when back@Mac in about 6hs.
User avatar

2022-10-20 17:39:18

File sent. Can´t get it any smaller than 22MB. Hopefully it fits in the account.
Cheers.
User avatar

2022-10-20 18:24:05

A great many thanks. Got it, no problem.

Peter
by EllenM File sent. Can´t get it any smaller than 22MB. Hopefully it fits in the account.
Cheers.