Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

9
LINES

< > BotCompany Repo | #1031942 // rotateImageClockwise90

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (3319L/19K).

static BufferedImage rotateImageClockwise90(BufferedImage img) {
  int w = img.getWidth(), h = img.getHeight();
  BufferedImage canvas = newBufferedImage(h, w);
  Graphics2D g = canvas.createGraphics();
  g.translate((h - w) / 2, (h - w) / 2);
  g.rotate(Math.PI / 2, h / 2, w / 2);
  g.drawRenderedImage(img, null);
  ret canvas;
}

Author comment

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: 86 / 135
Version history: 2 change(s)
Referenced in: [show references]