There are two ways to do so:
The most efficient way is to use ghostScript where we will directly run the following command.GhostScript is a suite of software and an interpreter for the PostScript language, PDFs and, related software and documentation.
gs -q -dQUIET -dPARANOIDSAFER -dBATCH -dNOPAUSE -dNOPROMPT \ dMaxBitmap=500000000 -dLastPage=1 -dAlignToPixels=0 -dGridFitTT=0 \ sDEVICE=jpeg -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -r72x72 \ sOutputFile=$OUTPUT -f$INPUT
Here $OUTPUT and $INPUT are the output and input filenames.
We can also do this conversion just by using ImageMagick software which does it in the following ways:-
Convert taxes.pdf taxes.jpg
We will convert these two page PDF file into 2 page JPEG file:taxes.jpg.1, taxes.jpg.2.
Then we will convert JPEG files into thumbnail using the following commands
convert -size axb taxes.jpg.1 -geometry axb +profile '*' thumbnail.jpg
convert -size axb taxes.jpg.2 -geometry axb +profile '*' thumbnail.jpg
Where a and b are the image dimensions.
This will result in thumbnail.jpg.1 and thumbnail.jpg.2 for the two pages.
So I always prefer the first way to do this problem because it is more efficient and is a one-step process as compared to the second one which is a two-step process.