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

12
LINES

< > BotCompany Repo | #1033849 // saveInImageDirectoryWithCounter

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

Libraryless. Click here for Pure Java version (9256L/53K).

1  
// defaults to .png
2  
static File saveInImageDirectoryWithCounter(S subPath, BufferedImage img) {
3  
  if (img == null) null;
4  
  assertNempty(subPath);
5  
  
6  
  File dir = imagesDir();
7  
  if (!isImageFileName(subPath)) subPath += ".png";
8  
  File f = makeFileNameUnique_beforeExtension_startWith1_noDot(newFile(dir, subPath));
9  
  saveImage(f, img);
10  
  infoBox("Saved image " + appendBracketed(img.getWidth(null) + "*" + img.getHeight(null)) + ": " + fileInfo(f));
11  
  ret f;
12  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1033849
Snippet name: saveInImageDirectoryWithCounter
Eternal ID of this version: #1033849/4
Text MD5: a1d997d67d58850e77d67974d415fde4
Transpilation MD5: 0ec07fbef25727edf6467fd445a5aa57
Author: stefan
Category: javax / io
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-01-07 01:25:45
Source code size: 470 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 140 / 204
Version history: 3 change(s)
Referenced in: [show references]