I have some low quality scans of book pages, saved as a PDF, that I would like to enhance. Since they’re text only, and the text is kind of faint, I think that using the erode filter on each page would probably work pretty well (it has in the past). The problem is, it would be nice to be able to use the erode filter on all the pages at once and not have to do each one individually.

When you open a single PDF page in GIMP, AFAICT, it imports it as an image file rather than a PDF, but I don’t know what type of image. I installed BIMP to see if I could do a batch erode that way, but it wasn’t able to do it. Is GIMP the way to go here, or would something like ImageMagick (which I know very little about) be better for this?

  • @Sekrin
    link
    221 hours ago

    File > Open As Layers (or CTRL + ALT + O) will open a PDF with each page being a separate layer. After it has loaded, select the first page / layer and apply your filter of choice, then use the arrow keys to move down through the layers and CTRL + F to repeat the filter. Once done, just use File > Export As to export the file as a PDF and select the option to export layers as pages.

    Not quite a batch run, but at two key presses per page it’s pretty quick.

    Alternatively, the G’MIC-Qt (https://gmic.eu) package has: Two functions that may help if you want to use the built in filters - one converts multiple layers into a single one (Layers to Tiles) and then another (Tiles to Layers) to convert it back again after you’ve applied your filter. It also has other filters, such as “Clean Text” or “Repair Scanned Document” that you might find useful, and you can specify using the Input Layers dropdown (bottom-centre of the dialog) that you want to apply the selected filter to “All” layers.