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

17
LINES

< > BotCompany Repo | #1035903 // toQOI - encode image as QOI (Quite OK Image) in memory. QOI is a super-fast alternative to PNG with similar compression rates

JavaX fragment (include) [tags: use-pretranspiled]

Uses 38K of libraries. Click here for Pure Java version (77L/1K).

!include once #1035902 // QOI Library [Include]

static byte[] toQOI(BufferedImage image) ctex {
  if (image == null) null;
  
  new ByteArrayOutputStream stream;
  var imageWriter = new QOIImageWriterSPI().createWriterInstance();
  
  try {
    imageWriter.setOutput(new javax.imageio.stream.MemoryCacheImageOutputStream(stream));
    imageWriter.write(image);
  } finally {
    imageWriter.dispose();
  }
  
  ret stream.toByteArray();
}

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): elmgxqgtpvxh, mqqgnosmbjvj, wnsclhtenguj

No comments. add comment

Snippet ID: #1035903
Snippet name: toQOI - encode image as QOI (Quite OK Image) in memory. QOI is a super-fast alternative to PNG with similar compression rates
Eternal ID of this version: #1035903/2
Text MD5: ef7b18478dba8e82637f11093b87ad39
Transpilation MD5: 107dac784a098d15f8bfff658f75d81c
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-08-11 19:13:32
Source code size: 455 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 151 / 200
Version history: 1 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1035904 - fromQOI - decode QOIimage