Page 1 of 1

pngs2pdf : Convert png images to pdfs & create single document

Posted: Mon Jan 13, 2025 7:42 am
by greengeek

Convert png images to pdf and combine them.

** Not useful for BookwormPup as Peasypdf is already on board there.

What is this utility intended for?
- I needed to produce a pdf copy of my passport.
- So I scanned each page in .png format (png being lossless so better quality than jpeg)
- Then I used this utility to convert each .png to .pdf
- Then combined the individual pdfs into one pdf document.

In the old days I used Peasypdf for this but now wanted reduced functionality in a small utility.
(So it is based on peasypdf but with variations)

pngs2pdf_gui.jpg
pngs2pdf_gui.jpg (16.41 KiB) Viewed 235 times

Versions for:

Fossa64 9.5 "Small" (Ozsouth's reduced Fossa) version

F6495Small_pngs2pdf_gg-0.2.pet
(63.35 KiB) Downloaded 3 times

****************************************************************

Fossa96_CE4 version

F96CE4_pngs2pdf_gg-0.2.pet
(3.49 KiB) Downloaded 7 times

****************************************************************

Fossa96_CE5-Alpha4 version
(Will probably be released after Alpha4 gets an inbuilt pdf viewer)


Re: Convert png images to pdfs & create single document

Posted: Mon Jan 13, 2025 7:45 am
by greengeek

Reserved


Re: Convert png images to pdfs & create single document

Posted: Mon Jan 13, 2025 9:26 am
by hikohan

ImageMagick

Code: Select all

convert in.png  -density 300 -resize 100% -page a6  out.pdf

or open image in Chrome browser, print as PDF via CUPS-PDF


Re: Convert png images to pdfs & create single document

Posted: Tue Jan 14, 2025 7:00 am
by Geek3579

And you can convert all PNG files to one PDF at once with ImageMagick:
convert "*.{PNG}" -quality 50 FILEOUT.pdf # to remove original PNG file, add: && rm *.PNG


Re: Convert png images to pdfs & create single document

Posted: Tue Jan 14, 2025 8:27 am
by MochiMoppel
Geek3579 wrote: Tue Jan 14, 2025 7:00 am

And you can convert all PNG files to one PDF at once with ImageMagick

You can do that with PeasyPDF too: Pic2PDF. However this function has no options and does not preserve the image sizes of original PNGs. It scales all images to a common page size (A4?). Unfortunately also scales up images that are smaller, making them blurry in the PDF. The 2-stop approach described by greengeek may be more accurate and result in a smaller PDF file, but with many images to process it can be tedious.


Re: Convert png images to pdfs & create single document

Posted: Tue Jan 14, 2025 8:51 am
by greengeek
MochiMoppel wrote: Tue Jan 14, 2025 8:27 am

The 2-stop approach described by greengeek may be more accurate and result in a smaller PDF file, but with many images to process it can be tedious.

Indeed, yes. I would like to make it more automated - but without requiring the additional weight of Imagemagick.

I think it just needs some smarter coding in terms of processing a directory of png's.

For now it works well for me, and only adds a small amount of deps (including in Fossa64 9.5 Small where I do most of my work...) - but I do hope to improve it in time.

Thanks for all suggestions and comments!