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

10
LINES

< > BotCompany Repo | #1007587 // toJPEG

JavaX fragment (include)

static byte[] toJPEG(BufferedImage img) ctex {
  new ByteArrayOutputStream stream;
  // need to drop alpha channel to avoid JDK bug
  ImageIO.write(dropAlphaChannelFromBufferedImage(img), "jpeg", stream);
  ret stream.toByteArray();
}

static byte[] toJPEG(File f) {
  ret toJPEG(loadImage2(f));
}

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: 560 / 613
Version history: 5 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1007605 - toJPG - synonym of toJPEG
#1035887 - jpegSize
#1035888 - toJPEGWithQuality