Bitmap bitmap = handleSamplingAndRotationBitmap(filePath, dimens[0], dimens[1], rotateIfNeeded);
if (bitmap == null) {
return copyFile(filePath, filePathOutput);
}
File file = new File(filePath);
<BUG>File fileScaled = new File(filePathOutput);
bitmap2file(bitmap, fileScaled, Bitmap.CompressFormat.JPEG);
</BUG>
copyExifRotation(file, fileScaled, rotateIfNeeded);
return filePathOutput;

Bitmap bitmap = handleSamplingAndRotationBitmap(filePath, dimens[0], dimens[1], rotateIfNeeded);
if (bitmap == null) {
return copyFile(filePath, filePathOutput);
}
File file = new File(filePath);
File fileScaled = new File(filePathOutput);
Bitmap.CompressFormat compressFormat = Bitmap.CompressFormat.JPEG;
if (getFileExtension(filePathOutput).toLowerCase().contains(Constants.EXT_PNG)) {
compressFormat = Bitmap.CompressFormat.PNG;
}
bitmap2file(bitmap, fileScaled, compressFormat);
copyExifRotation(file, fileScaled, rotateIfNeeded);
return filePathOutput;
