I use this command in my shell to convert from PDF to image
convert -density 150x150 <PDF filename> -append -quality 100 <Image filename>
The PDF has four pages, but I only need the last two. How can I remove the first two pages from the PDF and convert the ones which remain to an image?
I assume you are using ImageMagick in combination with GhostScript. You can specify the page number of the PDF like this:
where 0 is the page number minus 1 (indexing starts at 0).
In your special case it would be