This commit is contained in:
Anthony Stirling 2025-08-08 14:33:08 +01:00
parent 5b80a15950
commit 7e265ba0dd

View File

@ -121,7 +121,6 @@ public class ImageProcessingUtils {
BufferedImage image = null; BufferedImage image = null;
String filename = file.getOriginalFilename(); String filename = file.getOriginalFilename();
// Try different approaches for different file types
if (filename != null && filename.toLowerCase().endsWith(".psd")) { if (filename != null && filename.toLowerCase().endsWith(".psd")) {
// For PSD files, try explicit ImageReader // For PSD files, try explicit ImageReader
Iterator<ImageReader> readers = ImageIO.getImageReadersByFormatName("PSD"); Iterator<ImageReader> readers = ImageIO.getImageReadersByFormatName("PSD");
@ -134,16 +133,17 @@ public class ImageProcessingUtils {
reader.dispose(); reader.dispose();
} }
} }
} if (image == null) {
throw new IOException("Unable to read image from file: " + filename +
// Fallback to standard ImageIO.read for all files (including PSD if explicit reader failed) ". Supported PSD formats: RGB/CMYK/Gray 8-32 bit, RLE/ZIP compression");
if (image == null) { }
} else {
// For non-PSD files, use standard ImageIO
image = ImageIO.read(file.getInputStream()); image = ImageIO.read(file.getInputStream());
} }
if (image == null) { if (image == null) {
throw new IOException("Unable to read image from file: " + filename + throw new IOException("Unable to read image from file: " + filename);
". Supported PSD formats: RGB/CMYK/Gray 8-32 bit, RLE/ZIP compression");
} }
double orientation = extractImageOrientation(file.getInputStream()); double orientation = extractImageOrientation(file.getInputStream());