Charlie Gibbs <cgib…@kltpzyxm.invalid> wrote:
> [Here's an on-charter post for a change...] > > I was given some scans of sheet music from an iPad vict^H^H^H^Huser who > couldn't find the settings (if it has any) for its scanning function. > As a result, she wound up with a 9-page PDF file that takes up over > 30 megabytes. (When I scan a similar document on my machine the file > is about one megabyte.) A bit of digging came up with utilities that > tell me that her scan is in 24-bit colour at some ungodly resolution > (using JPEG to keep it from being even bigger). > > I've been looking at utilities like Ghostscript, but the documentation > is making my eyes glaze over. Is there a guide that can help me > re-sample the file, say to 300 dpi in monochrome?
If it really is a "scan" (as in an image of a sheet of paper) and if you are fine with it becoming monochrome, then you can do this: $ gs -dNOPAUSE -q -r300 -sDEVICE=tiffg4 -dBATCH -sOutputFile=page%02d.tiff big-monster.pdf This will give you a set of tiffg4 monochrome images, one for each page, at 300dpi. Then, you can reassemble a pdf by using 'tiff2pdf' from the libtiff package like so: $ tiffcp page*.tiff multi-page.tiff $ tiff2pdf -o new-smaller-file.pdf multi-page.tiff Note, if it is a 24bit scan, and the black's are not really black but instead a dark grey, then the above will create a dithered output that will look awful and will not G4 compress well at all. In which case, you have extra work to do (and you also need the netpbm utilities). First, convert to grey scale: $ gs -dNOPAUSE -q -r300 -sDEVICE=pgmraw -dBATCH -sOutputFile=page%02d.pgm big-monster.pdf Then threshold the grey scale to black, and convert back to G4 tiffs: $ for page in page*.pgm ; do pgmtopbm -threshold -value 0.82 $page | pnmtotiff -g4 > ${page%.pgm}.tiff ; done Set each tiff to say it is 300dpi $ for page in page*.tiff ; do tiffset -s 296 2 $page ; tiffset -s 282 300 $page ; tiffset -s 283 300 $page ; done Create a multipage tiff from the individual single page tiffs and then create a pdf from the multi-page tiff: $ tiffcp page*.tiff multi-page.tiff $ tiff2pdf -o new-smaller-file.pdf multi-page.tiff