Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
To take an image of a range, set the print area to the desired range and then set all margins to 0. Also set ImageOrPrintOptions.setOnePagePerSheet() to true.
The following code takes an image of the range E8:H10. Below is a screenshot of the source workbook used in the code. You can try the code with any workbook.
Input file

Executing the code creates an image of the range E8:H10 only.
Output image

You may also find the article Converting Worksheet to Different Image Formats helpful.
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.