private File resizedImage(File screenshotFile, int maxHeight) throws IOException {
String resizedScreenshotFilename = "scaled_" + screenshotFile.getName();
ResizableImage scaledImage = ResizableImage.loadFrom(screenshotFile).rescaleCanvas(maxHeight);
File scaledFile = new File(sourceDirectory, resizedScreenshotFilename);
scaledImage.saveTo(scaledFile);
if (shouldKeepOriginalScreenshots) {
saveCopyOf(screenshotFile);
}
screenshotFile.delete();