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

13
LINES

< > BotCompany Repo | #1004893 // resizeImageNoTransparency

JavaX fragment (include)

1  
static BufferedImage resizeImageNoTransparency(BufferedImage img, int newW, int newH) {
2  
  Image tmp = img.getScaledInstance(newW, newH, Image.SCALE_SMOOTH);
3  
  BufferedImage dimg = new BufferedImage(newW, newH, BufferedImage.TYPE_INT_RGB);
4  
  Graphics2D g2d = dimg.createGraphics();
5  
  g2d.drawImage(tmp, 0, 0, null);
6  
  g2d.dispose();
7  
  return dimg;
8  
}
9  
10  
static BufferedImage resizeImageNoTransparency(BufferedImage img, int newW) {
11  
  int newH = iround(img.getHeight()*(double) newW/img.getWidth());
12  
  ret resizeImageNoTransparency(img, newW, newH);
13  
}

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: 564 / 547
Referenced in: [show references]