Improving low resolution images downloaded from some librari
Moderator: kcleung
-
- active poster
- Posts: 1558
- Joined: Thu Jul 12, 2007 8:53 am
- notabot: 42
- notabot2: Human
- Location: Nice, France
- Contact:
Improving low resolution images downloaded from some librari
Sites like Levy Sheet Music, Bavarian State Library, University of North Carolina etc. offer low-resolution, color or greyscale images of sheet music instead of high-resolution B/W images. Intuitively this better-than-BW feature could be used to improve the BW rendering. The present images are ugly and waste a lot of ink when you print them.
I've thought of this method to make the conversion: I convert the .JPG image to another bigger image with Imagemagick and I convert it to BW with Imagemagick's -threshold option. When you make a bigger image with Imagemagick's -resize option this software doesn't simply duplicates pixels according to the scale factor you ask, but also have a filtering feature
that spreads each source pixels over the neighbouring pixels. Afterwards you can obtain a BW .pdf image with Imagemagick's -threshold option.
I've tried to improve Schubert, Camille's Soirees Parisiennes with this method, and I've uploaded the result below Pierre's upload. But my result still leaves to be desired. I think my noteheads look almost like high-resolution noteheads, but some other details are lost.
Does an Imagemagick expert know a better -filter or -convolve option? Or is there a better software available?
I've thought of this method to make the conversion: I convert the .JPG image to another bigger image with Imagemagick and I convert it to BW with Imagemagick's -threshold option. When you make a bigger image with Imagemagick's -resize option this software doesn't simply duplicates pixels according to the scale factor you ask, but also have a filtering feature
that spreads each source pixels over the neighbouring pixels. Afterwards you can obtain a BW .pdf image with Imagemagick's -threshold option.
I've tried to improve Schubert, Camille's Soirees Parisiennes with this method, and I've uploaded the result below Pierre's upload. But my result still leaves to be desired. I think my noteheads look almost like high-resolution noteheads, but some other details are lost.
Does an Imagemagick expert know a better -filter or -convolve option? Or is there a better software available?
-
- Posts: 6
- Joined: Thu May 28, 2009 4:33 pm
- notabot: 42
- notabot2: Human
Re: Improving low resolution images downloaded from some librari
Are you starting from the PDF? I used the PDF here: http://levysheetmusic.mse.jhu.edu/otcgi/llscgi60
The ImageMagick command I used to convert the first page of music is:
The [1] extracts the second page (IM counts pages from zero) which skips the cover page. The density specifies an initial dpi value for the conversion because without it, IM defaults to 72dpi which gives a low resolution image. You will get a much better quality image with the density set to 150 or higher and then you don't need to resize the image upwards at all. All that's left is to play with the threshold value.
Pete
The ImageMagick command I used to convert the first page of music is:
Code: Select all
convert -density 150 c_schubert.pdf[1] -threshold 60% c_schubert_1.gif
Pete
-
- active poster
- Posts: 1558
- Joined: Thu Jul 12, 2007 8:53 am
- notabot: 42
- notabot2: Human
- Location: Nice, France
- Contact:
Re: Improving low resolution images downloaded from some librari
I used the .JPEG images dirctely provided by Levy sheet music collection, for which there is a link in Pierre's entry:
https://jscholarship.library.jhu.edu/ha ... 74.2/20191
I didn't know there were aslo .pdf images available. Your link doesn't work.
https://jscholarship.library.jhu.edu/ha ... 74.2/20191
I didn't know there were aslo .pdf images available. Your link doesn't work.
-
- Site Admin
- Posts: 2249
- Joined: Sun Dec 10, 2006 11:18 pm
- notabot: 42
- notabot2: Human
- Contact:
Re: Improving low resolution images downloaded from some librari
Your monochrome conversion of the of the C. Schubert piece is pretty good. You should try it on one of the Chrysander Handel scores we have from the Bavarian State Library. Ideally, 600 x 600 dpi would be the goal for a full score. Piano music seems to work OK at 300 x 300. There are also the scores on Google Books, where they've done a very bizarre thing. Isolated systems or pages have been scanned at 150 dpi grayscale, while most of the scan is at 600 dpi monochrome. Look at vocal score for Saint Saens' opera ''Henry VIII'' to see what I'm talking about. Trying to print one of those scores will crash a printer with ease unless you happen to have one with a lot of RAM installed.
-
- Posts: 6
- Joined: Thu May 28, 2009 4:33 pm
- notabot: 42
- notabot2: Human
Re: Improving low resolution images downloaded from some librari
Go to: http://levy-test.dkc.jhu.edu/ and select "Search the Collection".coulonnus wrote:Your link doesn't work.
Search for "schubert" within "Composer, Lyricist, Arranger"
It will be the fifth entry and it has a "View PDF" link.
Pete
-
- active poster
- Posts: 1558
- Joined: Thu Jul 12, 2007 8:53 am
- notabot: 42
- notabot2: Human
- Location: Nice, France
- Contact:
Re: Improving low resolution images downloaded from some librari
Thanks for your help. This one has a better resolution, and IMO a -threshold 70%el_supremo wrote:Go to: http://levy-test.dkc.jhu.edu/ and select "Search the Collection".coulonnus wrote:Your link doesn't work.
Search for "schubert" within "Composer, Lyricist, Arranger"
It will be the fifth entry and it has a "View PDF" link.
Pete
option is enough for that one. I was starting from the .jpg images which are about 300-K big.
Last edited by coulonnus on Mon Jun 15, 2009 1:47 pm, edited 1 time in total.
-
- active poster
- Posts: 1558
- Joined: Thu Jul 12, 2007 8:53 am
- notabot: 42
- notabot2: Human
- Location: Nice, France
- Contact:
Re: Improving low resolution images downloaded from some librari
Gives about the same improved note heads, but also the same sort of missing portions of staff lines, note stems etc.Carolus wrote:Your monochrome conversion of the of the C. Schubert piece is pretty good. You should try it on one of the Chrysander Handel scores we have from the Bavarian State Library. Ideally, 600 x 600 dpi would be the goal for a full score. Piano music seems to work OK at 300 x 300.
Incidentally at Bavarian State Library Firefox won't let me save an image with a right mouse click unless I uncheck the Enable Javascript box!
Couldn't find that one. You might want to add a Misc_Test entry into the Composers:Category:Various and store a sample for me into it.Carolus wrote:There are also the scores on Google Books, where they've done a very bizarre thing. Isolated systems or pages have been scanned at 150 dpi grayscale, while most of the scan is at 600 dpi monochrome. Look at vocal score for Saint Saens' opera ''Henry VIII'' to see what I'm talking about. Trying to print one of those scores will crash a printer with ease unless you happen to have one with a lot of RAM installed.
Last edited by coulonnus on Mon Jun 15, 2009 1:48 pm, edited 1 time in total.
-
- Site Admin
- Posts: 2249
- Joined: Sun Dec 10, 2006 11:18 pm
- notabot: 42
- notabot2: Human
- Contact:
Re: Improving low resolution images downloaded from some librari
That's strange!Incidentally at Bavarian State Library Firefox won't let me save an image with a right mouse click unless I uncheck the Enable Javascript box!
Here's the link to the Saint-Saens score: http://imslp.org/wiki/Henry_VIII_%28Sai ... Camille%29 (You'll have to copy and paste this into your browser's URL window instead of clicking on the broken link.)
If you really like to do clean-up work, send me a PM and I can give you access to some CDSM files that need to have logos removed. Also, look elsewhere on this forum and you will find some of the threads addressing the issue, along with a ruby script one of our other contributors has written to automate the process to a degree.
-
- active poster
- Posts: 1558
- Joined: Thu Jul 12, 2007 8:53 am
- notabot: 42
- notabot2: Human
- Location: Nice, France
- Contact:
Re: Improving low resolution images downloaded from some librari
> Here's the link to the Saint-Saens score: http://imslp.org/wiki/Henry_VIII_%28Saint-
> Saëns%2C_Camille%29 (You'll have to copy and paste this into your browser's URL
> window instead of clicking on the broken link.)
You would have made my life easier by saying that the work was already on IMSLP! I guess page 62 of Preliminary and Act I is a good example of what you mean. My script still gives the same good and bad things as in my last attempts. For your printer-crash problems: couldn't you split the 100-page documents into five 20-page documents?
> If you really like to do clean-up work, send me a PM and I can give you access to
> some CDSM files that need to have logos removed. Also, look elsewhere on this
> forum and you will find some of the threads addressing the issue, along with a ruby > script one of our other contributors has written to automate the process to a degree.
I'll have a look tomorrow.
> Saëns%2C_Camille%29 (You'll have to copy and paste this into your browser's URL
> window instead of clicking on the broken link.)
You would have made my life easier by saying that the work was already on IMSLP! I guess page 62 of Preliminary and Act I is a good example of what you mean. My script still gives the same good and bad things as in my last attempts. For your printer-crash problems: couldn't you split the 100-page documents into five 20-page documents?
> If you really like to do clean-up work, send me a PM and I can give you access to
> some CDSM files that need to have logos removed. Also, look elsewhere on this
> forum and you will find some of the threads addressing the issue, along with a ruby > script one of our other contributors has written to automate the process to a degree.
I'll have a look tomorrow.
-
- Site Admin
- Posts: 2249
- Joined: Sun Dec 10, 2006 11:18 pm
- notabot: 42
- notabot2: Human
- Contact:
Re: Improving low resolution images downloaded from some librari
Sorry for not mentioning it was on IMSLP already! We have a fair number of the Google scores available - with the offending logos removed, etc.
The printing problem had nothing to do with the total page count, but with the combination of low-resolution grayscale (sometimes even color) images on the same pages with 600 dpi monochrome. The Google score which crashed the printer was a piano piece of only 12 pages. One way I discovered to deal with one of these scores - manually - was to export the images as TIFFs, increase the resolution on the grayscale exports to 600 x 600 dpi, then convert to monochrome 600 x 600 dpi using the diffusion dither filter in Photoshop. The images were then assembled manually into pages and the resulting TIFFs then merged into a new PDF, which was then easy to print.
That is a long, tedious, process however. In light of the massive scale of files we have to deal with here, we are hoping to see the development of an automated process by which such images can be converted to the easily printed monochrome PDFs.
The printing problem had nothing to do with the total page count, but with the combination of low-resolution grayscale (sometimes even color) images on the same pages with 600 dpi monochrome. The Google score which crashed the printer was a piano piece of only 12 pages. One way I discovered to deal with one of these scores - manually - was to export the images as TIFFs, increase the resolution on the grayscale exports to 600 x 600 dpi, then convert to monochrome 600 x 600 dpi using the diffusion dither filter in Photoshop. The images were then assembled manually into pages and the resulting TIFFs then merged into a new PDF, which was then easy to print.
That is a long, tedious, process however. In light of the massive scale of files we have to deal with here, we are hoping to see the development of an automated process by which such images can be converted to the easily printed monochrome PDFs.
-
- active poster
- Posts: 293
- Joined: Sun Apr 23, 2006 5:08 am
- notabot: YES
- notabot2: Bot
- Location: Phoenix, AZ
Re: Improving low resolution images downloaded from some librari
I've let the Google Books people know about the problem with mixing and matching grayscale and b&w in their music scores. They try to automatically figure out which parts of a page are text, image, and color image (there might be a few other categories also) and segment based on that. So it's thinks some systems are images and others are text. The system wasn't designed with music in mind really. Unfortunately it's a low priority item for them.
Also as far as picking a threshold - Does imagemagick really not have automatic global thresholding built in? I see that it includes a local adaptive thresholding method (http://www.imagemagick.org/script/comma ... ns.php#lat) but in this case that's not what is needed. This is disappointing since there are many standard algorithms out there to do it (i.e. otsu).
Also as far as picking a threshold - Does imagemagick really not have automatic global thresholding built in? I see that it includes a local adaptive thresholding method (http://www.imagemagick.org/script/comma ... ns.php#lat) but in this case that's not what is needed. This is disappointing since there are many standard algorithms out there to do it (i.e. otsu).
-
- active poster
- Posts: 1558
- Joined: Thu Jul 12, 2007 8:53 am
- notabot: 42
- notabot2: Human
- Location: Nice, France
- Contact:
Re: Improving low resolution images downloaded from some librari
Same for me. This big patch of 150 dpi and 600 dpi offends Imagemagick, andCarolus wrote:There are also the scores on Google Books, where they've done a very bizarre thing. Isolated systems or pages have been scanned at 150 dpi grayscale, while most of the scan is at 600 dpi monochrome. Look at vocal score for Saint Saens' opera ''Henry VIII'' to see what I'm talking about. Trying to print one of those scores will crash a printer with ease unless you happen to have one with a lot of RAM installed.
all I can do is extract the 150-dpi sections and 600-dpi sections into a set of files, process the 150-dpi ones, and glue everything together.
It seems the only way to avoid crashing printers would be your posting chunks of the score which have the same resolution in them.
Last edited by coulonnus on Mon Jun 15, 2009 9:06 am, edited 1 time in total.
-
- active poster
- Posts: 1558
- Joined: Thu Jul 12, 2007 8:53 am
- notabot: 42
- notabot2: Human
- Location: Nice, France
- Contact:
Re: Improving low resolution images downloaded from some librari
Thanks. This -lat option will be useful for those images that have a rather dark background near the left or right margin.horndude77 wrote:Also as far as picking a threshold - Does imagemagick really not have automatic global thresholding built in?
-
- regular poster
- Posts: 22
- Joined: Sun Aug 02, 2009 3:27 pm
- notabot: 42
- notabot2: Human
Re: Improving low resolution images downloaded from some librari
I don't use ImageMagic but IrfanView, but whatever software you use the resizing should be done with a Lanczos filter and, if possible, on the original color or grayscale picture. I got good results even with bigger scaling factors up to more than 600%. This one for example whas done using an orininally 160dpi color scan and this one using a monocrome scan.
-
- active poster
- Posts: 1558
- Joined: Thu Jul 12, 2007 8:53 am
- notabot: 42
- notabot2: Human
- Location: Nice, France
- Contact:
Re: Improving low resolution images downloaded from some librari
Great! I obtain as good a pdf with ImageMagick, but it is more than 10 times bigger!Piupianissimo wrote:I don't use ImageMagic but IrfanView, but whatever software you use the resizing should be done with a Lanczos filter and, if possible, on the original color or grayscale picture[...]