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

17
LINES

< > BotCompany Repo | #1021826 // saveICO - save image as .ico (e.g. favicon.ico)

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

Uses 30K of libraries. Click here for Pure Java version (9420L/52K).

// TODO: this is garbage as a favicon.ico
// It needs all the different sizes (16x16, 32x32, 48x48)

lib 1400188 // image4j (https://sourceforge.net/projects/image4j/files/image4j-core/0.7.2/)

import net.sf.image4j.codec.ico.ICOEncoder;

static File saveICO(File f, BufferedImage img) ctex {
  var img2 = cropToSquare(img);
  L<Int> sizes = ll(16,32, 48);
  ICOEncoder.write(map(sizes, size -> resizeImage(img2, size)), f);
  ret f;
}

static File saveICO(BufferedImage img, File f) {
  ret saveICO(f, img);
}

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1021826
Snippet name: saveICO - save image as .ico (e.g. favicon.ico)
Eternal ID of this version: #1021826/6
Text MD5: d548bb9b78c5b6e3a364c77b5504018b
Transpilation MD5: eae970490948fecb42a19974015b57b4
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-08-30 01:49:47
Source code size: 526 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 225 / 254
Version history: 5 change(s)
Referenced in: [show references]