/** Rotate the image by 180° */
UTURN
}
+
@Override
protected boolean check() {
// Will not work if ImageIO is not available
public static BufferedImage fromImage(Image img) throws IOException {
return fromImage(img, Rotation.NONE);
}
-
+
/**
* Convert the given {@link Image} into a {@link BufferedImage} object,
* respecting the EXIF transformations if any.
* @throws IOException
* in case of IO error
*/
- public static BufferedImage fromImage(Image img, Rotation rotation) throws IOException {
+ public static BufferedImage fromImage(Image img, Rotation rotation)
+ throws IOException {
InputStream in = img.newInputStream();
BufferedImage image;
try {
} finally {
inData.close();
}
- extra = ", content: "
- + new String(data, "UTF-8");
+ extra = ", content: " + new String(data, "UTF-8");
} catch (Exception e) {
extra = ", content unavailable";
}
affineTransform = null;
break;
}
-
+
if (rotation == null)
rotation = Rotation.NONE;
-
+
switch (rotation) {
- case LEFT:
+ case RIGHT:
if (affineTransform == null) {
affineTransform = new AffineTransform();
}
affineTransform.translate(height, 0);
affineTransform.rotate(Math.PI / 2);
break;
- case RIGHT:
+ case LEFT:
if (affineTransform == null) {
affineTransform = new AffineTransform();
}
} finally {
g.dispose();
}
-
+
return resizedImage;
}
}