3 ms·
GNOME Desktop users can put this in a Bash script in ~/.local/share/nautilus/ for more convincing looking fake PDF scans, accessible from your right-click menu.
by tombrossman 8mo ago
GNOME Desktop users can put this in a Bash script in ~/.local/share/nautilus/ for more convincing looking fake PDF scans, accessible from your right-click menu. I do not recall where I copied it from originally to give credit so thanks, random internet person (probably on Stack Exchange). It works perfectly.
ROTATION=$(shuf -n 1 -e '-' '')$(shuf -n 1 -e $(seq 0.05 .5))
for pdf in "$@";
do magick -density 150 $pdf \
-linear-stretch '1.5%x2%' \
-rotate 0.4 \
-attenuate '0.01' \
+noise Multiplicative \
-colorspace 'gray' \
"${pdf%.*}-fakescan.${pdf##*.}"
done
- streetfighter64 8mo agoShouldn't $ROTATION be set inside the loop and actually used in the magick command?
- tombrossman 8mo agoYou know, now that you point it out that seems obvious. I think maybe I was experimenting with rotation and left that in, unused. I did this years ago. The loop works OK though. Thanks for the feedback (and now I have to finish editing that script ...)
- barrkel 8mo agoThat seq is probably supposed to be $(seq 0.05 0.05 0.5). Right now it's always 0.05. Note that you can get random numbers straight from bash with $RANDOM. It's 15 bit (0 to 32767) but good enough here; this would get between 0.05 and 0.5: $(printf "0.%.4d\n" $((500 + RANDOM % 4501)))
- lordgrenville 8mo agoNothing about this is specific to GNOME, right? Imagemagick is cross-platform
- turboponyy 8mo agoI guess the Gnome-specific part is that Gnome comes with the Nautilus file browser, and the instructions add a script for Nautilus. But yea, this will work as long as you have imagemagick and Nautilus installed.
- lordgrenville 8mo agoOh I missed that part, was just looking at the script
- landdate 8mo agoor just run script and input pdf as argument...
- mimischi 8mo agoI like https://lookscanned.io/ https://lookscanned.io/
- landdate 8mo ago[flagged]
- landdate 8mo ago[flagged]
- taskforcegemini 8mo agoyou sound as grumpy as my cat looks. there's no need for this language