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

6
LINES

< > BotCompany Repo | #1007276 // img_getCenterPortion

JavaX fragment (include)

static BufferedImage img_getCenterPortion(BufferedImage img, int w, int h) {
  int iw = img.getWidth(), ih = img.getHeight();
  if (iw < w || ih < h) fail("Too small");
  int x = (iw-w)/2, y = (ih-h)/2;
  ret clipBufferedImage(img, x, y, w, h);
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1007276
Snippet name: img_getCenterPortion
Eternal ID of this version: #1007276/1
Text MD5: 821506b279b7ab3e6675c39e8a181a36
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-03-14 14:57:06
Source code size: 251 bytes / 6 lines
Pitched / IR pitched: No / No
Views / Downloads: 452 / 491
Referenced in: [show references]