Libraryless. Click here for Pure Java version (4789L/27K).
1 | static void savePNG(BufferedImage img, File file) ctex {
|
2 | File tempFile = new File(file.getPath() + "_temp"); |
3 | CriticalAction ca = beginCriticalAction("Save " + f2s(file));
|
4 | try {
|
5 | ImageIO.write(img, "png", mkdirsFor(tempFile)); |
6 | file.delete(); |
7 | tempFile.renameTo(file); |
8 | } finally {
|
9 | ca.done(); |
10 | } |
11 | } |
12 | |
13 | // gotta love convenience & program-smartness |
14 | static void savePNG(File etc file, BufferedImage img) {
|
15 | savePNG(img, file); |
16 | } |
17 | |
18 | ifclass RGBImage |
19 | static void savePNG(File file, RGBImage img) {
|
20 | savePNG(file, img.getBufferedImage()); |
21 | } |
22 | endif |
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1003962 |
| Snippet name: | savePNG |
| Eternal ID of this version: | #1003962/9 |
| Text MD5: | d96a9e8864bea038dbd521e27975a876 |
| Transpilation MD5: | 75f62297081d0df803a58c0741f0afff |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2022-01-08 19:25:42 |
| Source code size: | 579 bytes / 22 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 971 / 1089 |
| Version history: | 8 change(s) |
| Referenced in: | [show references] |