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

13
LINES

< > BotCompany Repo | #1004893 // resizeImageNoTransparency

JavaX fragment (include)

static BufferedImage resizeImageNoTransparency(BufferedImage img, int newW, int newH) {
  Image tmp = img.getScaledInstance(newW, newH, Image.SCALE_SMOOTH);
  BufferedImage dimg = new BufferedImage(newW, newH, BufferedImage.TYPE_INT_RGB);
  Graphics2D g2d = dimg.createGraphics();
  g2d.drawImage(tmp, 0, 0, null);
  g2d.dispose();
  return dimg;
}

static BufferedImage resizeImageNoTransparency(BufferedImage img, int newW) {
  int newH = iround(img.getHeight()*(double) newW/img.getWidth());
  ret resizeImageNoTransparency(img, newW, newH);
}

Author comment

Began life as a copy of #1004224

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1004893
Snippet name: resizeImageNoTransparency
Eternal ID of this version: #1004893/1
Text MD5: 6bd4da21c6fe4e9b27d7292effc71e23
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-09-14 17:27:06
Source code size: 558 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 563 / 546
Referenced in: [show references]