add posterization

main
Ingolf Wagner 2022-06-23 19:13:19 +02:00
parent 2ef4e3266c
commit d5af1e9d39
Signed by: palo
GPG Key ID: 76BF5F1928B9618B
1 changed files with 23 additions and 0 deletions

View File

@ -27,6 +27,8 @@
devShells.default = pkgs.mkShell {
buildInputs = [
# building seamly2d and valentina
pkgs.qt5.full
pkgs.qtcreator
pkgs.libGL
@ -35,6 +37,27 @@
pkgs.qt5.qtxmlpatterns
pkgs.qt5.qt3d
pkgs.qt5.qmake
# poster
pkgs.imagemagick
pkgs.ghostscript
# A4 is 2480 x 3508 Pixel
# A4 with 100px space on top bottom left and right is : 2280 x 3308 Pixel
(pkgs.writers.writeBashBin "posterize" ''
${pkgs.imagemagick}/bin/convert -density 300 -depth 8 -quality 85 input.pdf input.png
${pkgs.imagemagick}/bin/convert input.png -crop 2280x3308 +repage output_a4_%02d.png
for file in output_a4_*
do
${pkgs.imagemagick}/bin/convert \
$file \
-gravity center \
-background gray \
-extent 2480x3508 \
final_$file
done
${pkgs.imagemagick}/bin/convert final_*.png -quality 100 output.pdf
rm -rf *.png
'')
];
};