Below are quick examples of Ghostscript commands (these are the ones used in my previously posted scripts, but in a form that is closer to what would be typed to run from the command line, rather than in a bash script). I’ve found using Ghostscript directly to work with PDFs is far faster and uses less memory than ImageMagick.
Example 1 (color LZW TIFF files):
gs -sDEVICE=tiff24nc -sCompression=lzw -r300x300 -dNOPAUSE -sOutputFile="path\to\output\filename%04d.tif" inputfile.pdf
In the above -sDEVICE sets the file format to full color (24 bpp) TIFF, -sCompression sets lzw compression (LZW has been off-patent long enough for pretty much universal support, and makes the files a manageable size), -r is the resolution, for color images 300×300 is generally high enough, -sNOPAUSE keeps Ghostscript running between pages, and -sOutputFile sets the destination file. The %04d in the output file is replaced by 4 digit (leading 0′s) page numbers.
Also, available for smaller files, if the format is acceptable, is to set -sDEVICE to png16m, this is for 24 bpp (16 million color) PNG files (make sure the output file ends in .png too). When making PNG files, eliminate the -Compression option.
There is no built in device in Ghostscript to make LZW color TIFF files (the tifflzw device is monochrome), but tiff24nc supports the -Compression option.
Example 2 (monochrome group 4 TIFF files):
gs -sDEVICE=tiffg4 -dNOPAUSE -r600x600 -sOutputFile="path\to\output\filename%04d.tif" inputfile.pdf
The above script does the same, but using group 4 monochrome compression (the tiffg4 device has compression built in), additionally it uses 600×600 resolution, which is what I like to use for monochrome (it allows for better dithering of gray, and all of the small details in spreadsheets to be readable).
Example 3 (color JPEG files):
gs -sDEVICE=jpeg -dNOPAUSE -r300x300 -sOutputFile="path\to\output\filename%04d.tif" inputfile.jpg
Using JPEG compression above creates far smaller files than (color) TIFF or PNG, but loses quality, this quality loss can be very obvious in areas of high contrast, such as text or line drawings.