When scanning documents, I basically end up with black-white images, either because the scanner already provides line-drawing input, or because of the threshold filter. In this case, it would be fantastic if the white background could be replaced with transparency. It renders the same as PDF, but the benefit is that it's easy to later add a watermark to the PDF, which is not possible if the background is non-transparent. Or well, then you just can't see the watermark. Thanks, martin
Can't this be achieved with a user defined tool?
Regarding the following, written by "Jeff" on 2022-04-10 at 12:52 Uhr +0000:
Sure thing, for instance:
```
convert -size 2480x3508 -depth 300x300 -transparent white in.pdf out.pdf
```
I see four problems with this though:
1. This operation would be a lot faster on the PNM files, rather
than first writing the PDF, and then basically accessing the PDF
bitmaps page-wise for this operation;
2. The ImageMagick conversion really messes with the PDF file in
ways I haven't figure out yet. If I apply it to the PNM files,
there is no quality loss;
3. A user-defined tool does not have access to the resolution to be
used, unlike gscan2pdf. I can calculate the dimensions, but only
if I have the resolution;
4. Invoking user-defined tools is cumbersome, especially if you want
to do so multiple times
(https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1007197)
I understand your point, but the argument can be made about all of
the post-processing tools built-in, and the question becomes which
one of those are so commonly used that they should be built-in. I
never use unsharp mask, negation, brigthness/contrast, or even OCR,
but they are built-in.
The user-defined tools operate on the source images, not the resulting PDF. I think you might be mixing them up with the post-save hook, which does operate on the PDF. The user-defined tools currently offer 3 variables, %i for input filename, %o for output filename, and %r for resolution. Absolutely. I was not suggesting it shouldn't be added, only provide a workaround until I found time to do so.
Regarding the following, written by "Jeff" on 2022-04-11 at 06:05 Uhr +0000: Oh yes, then I was indeed confused. Then I think a better UI/UX for user-defined tools, and possibly the ability to invoke any subset of them automatically during the scan would do just fine. Also, have a look at how Geeqie does user-defined actions, using `.desktop` entries. Not the nicest, but it's a standard, and means it can easily be brought into the menus. Having units like `.desktop` files also means we could start a `contrib` collection for gscan2pdf, rather than providing them all off the shelf for everyone. Best,
I'm sure the UI/UX could be improved. I'd love to hear any suggestions. If you look at the post-processing tab of the scan window, you should be able to invoke any of the user-defined tools as part of your workflow. I'd not seen Geeqie before. Thanks for the heads-up.
Regarding the following, written by "Jeff" on 2022-04-12 at 09:42 Uhr +0000: I saw that, and then promptly forgot about it when I found out it actually doesn't post-process the PDF file, which was what I wanted at the time. But yeah, using `mogrify -transparent white %i` as part of the post-processing pipeline works. For completeness, here is how to chuck a watermark onto the PDF generated with transparent background: ``` convert -size 4330x -density 300x300 -background transparent -gravity center -fill grey label:"This is a long text" -trim -rotate -54 +repage -resize $((2480*.8))x$((3508*.8)) -extent 2480x3508 /tmp/watermark.png convert /tmp/watermark.png /tmp/watermark.pdf pdftk from-gscan2pdf.pdf background /tmp/watermark.pdf output /tmp/target.pdf ``` I am still trying to combine the first two commands into one, see [here](https://github.com/ImageMagick/ImageMagick/discussions/5039) for the discussion.
Es gibt eine Familienspende in Höhe von 1.850.000,00 USD von Cheng Charlie Saephan. Bitte antworten Sie für weitere Informationen. Denken Sie daran, Ihrer Familie und den Bedürftigen in Ihrer Umgebung Gutes zu tun. Dies ist bereits der zweite Versuch, Sie zu erreichen. Bitte antworten Sie für weitere Details.