Libraryless. Click here for Pure Java version (3319L/19K).
1 | static BufferedImage rotateImageClockwise90(BufferedImage img) { |
2 | int w = img.getWidth(), h = img.getHeight(); |
3 | BufferedImage canvas = newBufferedImage(h, w); |
4 | Graphics2D g = canvas.createGraphics(); |
5 | g.translate((h - w) / 2, (h - w) / 2); |
6 | g.rotate(Math.PI / 2, h / 2, w / 2); |
7 | g.drawRenderedImage(img, null); |
8 | ret canvas; |
9 | } |
Began life as a copy of #1015056
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx
No comments. add comment
Snippet ID: | #1031942 |
Snippet name: | rotateImageClockwise90 |
Eternal ID of this version: | #1031942/3 |
Text MD5: | 004a331ea4724d96f972d22d75d56198 |
Transpilation MD5: | c476872cee9d1c3ab549d77410080159 |
Author: | stefan |
Category: | javax / imaging |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-08-03 17:30:45 |
Source code size: | 340 bytes / 9 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 189 / 279 |
Version history: | 2 change(s) |
Referenced in: | [show references] |