pngs2pdf : Convert png images to pdfs & create single document

Moderator: Forum moderators

Post Reply
User avatar
greengeek
Posts: 1438
Joined: Thu Jul 16, 2020 11:06 pm
Has thanked: 568 times
Been thanked: 200 times

pngs2pdf : Convert png images to pdfs & create single document

Post 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 238 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)

Last edited by greengeek on Wed Jan 15, 2025 5:50 pm, edited 4 times in total.
User avatar
greengeek
Posts: 1438
Joined: Thu Jul 16, 2020 11:06 pm
Has thanked: 568 times
Been thanked: 200 times

Re: Convert png images to pdfs & create single document

Post by greengeek »

Reserved

hikohan
Posts: 26
Joined: Wed Mar 13, 2024 12:08 am
Has thanked: 1 time
Been thanked: 7 times

Re: Convert png images to pdfs & create single document

Post 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

Geek3579
Posts: 281
Joined: Sat Jul 18, 2020 1:07 pm
Has thanked: 81 times
Been thanked: 72 times

Re: Convert png images to pdfs & create single document

Post 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

User avatar
MochiMoppel
Posts: 1281
Joined: Mon Jun 15, 2020 6:25 am
Location: Japan
Has thanked: 22 times
Been thanked: 467 times

Re: Convert png images to pdfs & create single document

Post 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.

User avatar
greengeek
Posts: 1438
Joined: Thu Jul 16, 2020 11:06 pm
Has thanked: 568 times
Been thanked: 200 times

Re: Convert png images to pdfs & create single document

Post 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!

Post Reply

Return to “Documents”