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).

// defaults to .png
static File saveInImageDirectoryWithCounter(S subPath, BufferedImage img) {
  if (img == null) null;
  assertNempty(subPath);
  
  File dir = imagesDir();
  if (!isImageFileName(subPath)) subPath += ".png";
  File f = makeFileNameUnique_beforeExtension_startWith1_noDot(newFile(dir, subPath));
  saveImage(f, img);
  infoBox("Saved image " + appendBracketed(img.getWidth(null) + "*" + img.getHeight(null)) + ": " + fileInfo(f));
  ret f;
}

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: 77 / 123
Version history: 3 change(s)
Referenced in: [show references]