ImageMagic library not without reason is called magic, it can handle image operations like scale,resize,rotate,filter,clip and 1000+ others.
Here is simple CLI command to extract one page from PDF file and save it as JPEG image
convert -density 300 doc.pdf[160] page.jpg
Where
If you need to generate PDF from set of images you can try these commands
convert *.jpg foo.pdf
convert -page A4 red.jpg -gravity center -format pdf out.pdf