Uses 38K of libraries. Click here for Pure Java version (9826L/55K).
1 | // I get between 13 and 16 ms both for compressing and decompressing |
2 | // a 2.1 MP screenshot on my Ryzen 4700S. |
3 | |
4 | static byte[] testQOI(BufferedImage img default shootScreen2()) {
|
5 | time "Compress" {
|
6 | byte[] qoi = toQOI(img); |
7 | } |
8 | |
9 | print("Image size: " + str_megapixels(img));
|
10 | print("Compressed: " + nBytes(qoi);
|
11 | var bpp = bitsPerPixel(qoi, img); |
12 | print("Bits per pixel: " + formatDouble2(bpp));
|
13 | print("Compression factor over RGB: " + formatDouble1(doubleRatio(24, bpp)));
|
14 | |
15 | time "Decompress" {
|
16 | var restoredImage = fromQOI(qoi); |
17 | } |
18 | assertSameImage(img, restoredImage); |
19 | print("Image restoration OK");
|
20 | |
21 | ret qoi; |
22 | } |
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): elmgxqgtpvxh, mqqgnosmbjvj, wnsclhtenguj
No comments. add comment
| Snippet ID: | #1035906 |
| Snippet name: | testQOI - test Pure Java QOI compression & decompression (OK!) |
| Eternal ID of this version: | #1035906/6 |
| Text MD5: | cdb3c6ca07887f69da8ba61a4b9aff3c |
| Transpilation MD5: | 4aa9677bbc9ca4206eec7e4c6e62cf5b |
| 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:31:35 |
| Source code size: | 660 bytes / 22 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 344 / 462 |
| Version history: | 5 change(s) |
| Referenced in: | [show references] |