ImageMagick’s convert tool is my preference.
The convert program is a member of the ImageMagick suite of tools.
Use it to convert between image formats as well as resize an image,
blur, crop, despeckle, dither, draw on, flip, join, re-sample, and much more.
convert [input-option] input-file [output-option] output-file`
If you want the image files (and thus, their quality and file size) unaltered, and just put a PDF container around them:
convert In.png In-2.png Someother-*.png Result.pdf
In case you want to have a smaller file size, and you are okay with a loss in quality, you can convert them to the JPEG format first. (ImageMagick also supports changing the PNG compression level, but usually your input files are already using the highest level.)
convert 1.png 2.png -compress jpeg -quality 50 Result.pdf
Use a value between 0 and 100 for the quality option.
Alternatively, you can reach a lower file size (and quality) by resampling the images to a certain resolution.
convert *.png 2.png -resample 300 Result.pdf
The value for resample refers to the number of pixels per inches. ImageMagick reads the original density from EXIF part of the input images, falling back to 72 dpi. You can use the density parameter to set a custom resolution for the input images.
You can of course also combine the compress
, quality
, and resample
parameters.