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

10
LINES

< > BotCompany Repo | #1007587 // toJPEG

JavaX fragment (include)

1  
static byte[] toJPEG(BufferedImage img) ctex {
2  
  new ByteArrayOutputStream stream;
3  
  // need to drop alpha channel to avoid JDK bug
4  
  ImageIO.write(dropAlphaChannelFromBufferedImage(img), "jpeg", stream);
5  
  ret stream.toByteArray();
6  
}
7  
8  
static byte[] toJPEG(File f) {
9  
  ret toJPEG(loadImage2(f));
10  
}

Author comment

Began life as a copy of #1003996

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1007587
Snippet name: toJPEG
Eternal ID of this version: #1007587/6
Text MD5: 0fa739aa91a447068da2852ebb1ddfd4
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-11-25 00:28:53
Source code size: 308 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 559 / 613
Version history: 5 change(s)
Referenced in: [show references]