04-09-2021, 10:02 AM (This post was last modified: 04-09-2021, 10:12 AM by abrogard.)
I just downloaded a sewing machine manual pdf and it is very faint.
Is there some smart little app which will enable gimp to run through all 35 pages of it and automatically raise the contrast or darken up the lines, somehow make it more legible?
Trying to find something with a GUI and multi-layer provision.
Assuming that the single page PDF is representative of the whole 35 pages. It is an image wrapped up in a PDF, extracting the image (linux pdfimages) it comes out at about 2400 x 1600 pix A reasonable size but otherwise not great quality.
One way:
1. Import the 35 pages setting the ppi to 300
2. Crop the page down, might save a bit of file size. Make sure 'Delete cropped pixels is ON
This using the Gimp g'mic plugin which can adjust all the layers. Get from http://www.gmic.eu
3. In the repair section "Repair Scanned Documents" to clean up the background a little. Set Smoothness = 1 / white level to 100 / black level to 0 Input set to All and Output in place or new image. Apply that.
4. Another gmic filter in the Details section, Sharpen(deblur) Just use the default settings and Input = All Output inplace (or new image)
Export that to a PDF. Warning Gimp makes big PDF's It is the way the image data is compressed. Nothing you can do about it.
This a comparison in a PDF viewer between the original and the Gimp PDF.
(04-09-2021, 01:17 PM)rich2005 Wrote: Trying to find something with a GUI and multi-layer provision.
Assuming that the single page PDF is representative of the whole 35 pages. It is an image wrapped up in a PDF, extracting the image (linux pdfimages) it comes out at about 2400 x 1600 pix A reasonable size but otherwise not great quality.
One way:
1. Import the 35 pages setting the ppi to 300
2. Crop the page down, might save a bit of file size. Make sure 'Delete cropped pixels is ON
This using the Gimp g'mic plugin which can adjust all the layers. Get from http://www.gmic.eu
3. In the repair section "Repair Scanned Documents" to clean up the background a little. Set Smoothness = 1 / white level to 100 / black level to 0 Input set to All and Output in place or new image. Apply that.
4. Another gmic filter in the Details section, Sharpen(deblur) Just use the default settings and Input = All Output inplace (or new image)
Export that to a PDF. Warning Gimp makes big PDF's It is the way the image data is compressed. Nothing you can do about it.
This a comparison in a PDF viewer between the original and the Gimp PDF.
I've found that using the Erode filter to widen the lines improves the image a lot. Is there a GMIC equivalent?
04-09-2021, 04:53 PM (This post was last modified: 04-09-2021, 05:24 PM by rich2005.)
(04-09-2021, 04:41 PM)Ofnuts Wrote: I've found that using the Erode filter to widen the lines improves the image a lot. Is there a GMIC equivalent?
Not that I can find. (well there is, one of alfre's but it does not work with multiple layers - produces a black image)
Unless you can provide a bespoke plugin, an alternative for us scripting-deficient mortals is maybe each page as a separate image, then a BIMP batch process. Then assemble the adjusted images into a PDF.
edit: or as I would probably do: use erode manually on each layer, only 35 layers, not a big deal, ctrl-f to repeat last filter.
04-09-2021, 09:24 PM (This post was last modified: 04-09-2021, 09:25 PM by Ofnuts.)
(04-09-2021, 04:53 PM)rich2005 Wrote:
(04-09-2021, 04:41 PM)Ofnuts Wrote: I've found that using the Erode filter to widen the lines improves the image a lot. Is there a GMIC equivalent?
Not that I can find. (well there is, one of alfre's but it does not work with multiple layers - produces a black image)
Unless you can provide a bespoke plugin, an alternative for us scripting-deficient mortals is maybe each page as a separate image, then a BIMP batch process. Then assemble the adjusted images into a PDF.
edit: or as I would probably do: use erode manually on each layer, only 35 layers, not a big deal, ctrl-f to repeat last filter.
Can be done a bit more easily in the Python console:
Code:
image=gimp.image_list()[0]
for layer in image.layers: pdb.plug_in_erode(image, layer, 1, 0, 1., 15,0, 255)
Notes:
There must be a single image opened in Gimp, otherwise the first line may catch the wrong one
After the second line, strike [enter] until you are back to the > > > prompt
Quote:I've got all 35 into the latest version of gimp. ...cropped one. couldn't find how to crop all simultaneously.
Are the 35 loaded as layers ? If they are, the crop tool will crop the whole image. Make sure the crop tool options Current layer only is OFF and Delete cropped pixels is ON.
Quote:I do have a 'batch image manipulation' menu choice there but I was unable to figure out how to use it to do these things.
You have BIMP plugin? Too much time on my hands today IMHO it is faster to edit each layer (or image) by hand, however, as an example.
Open the PDF (I found a single PDF for that manual) one way or another, as layers. Make sure ppi is 300.
Crop the image.
Export the cropped image layers as individual images. There are plugins for this, if you do not already have one try Ofnuts plugin https://sourceforge.net/projects/gimp-to...p/download
In BIMP
Open the 35 images. BIMP does not open / save PDF hence the above process.
Add three procedures
1. color correction with brightness about 0.2 and contrast 0.04
2. other gimp procedure - gimp-level-auto
3. other gimp procedure - erode with settings 1 0 1 15 255 0
Set up an output folder and apply BIMP.
For a new PDF.
Open the corrected images in GIMP 'Open as layers'
Export as a PDF with 'Layers As Pages' enabled
Remember I remarked that Gimp makes big PDF's - This one no different. 33 MB file size. However using LibreOffice and assembling the images in separate pages, got one down to 11 MB. https://www.dropbox.com/s/u749veg1bz7q7r...l.pdf?dl=0
(04-10-2021, 01:05 PM)rich2005 Wrote: Remember I remarked that Gimp makes big PDF's - This one no different. 33 MB file size. However using LibreOffice and assembling the images in separate pages, got one down to 11 MB.
Had a similar problem recently, making a PDF from scans (one PDF, 3 JPEGs, around 380K each). Exporting a 4-layers, 150PPI A4 doc to PDF from Gimp yielded a 5MB PDF.