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

9
LINES

< > BotCompany Repo | #1031273 // fixImageFileName - e.g. rename to ".jpg" if it is actually a JPEG. actually renames the file

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

Libraryless. Click here for Pure Java version (3331L/19K).

static File fixImageFileName(File file) {
  if (!isFile(file)) ret file;
  
  if (isJPEG(file))
    ret renameFile_assertTrue(file, changeExtension(file, ".jpg"));
  if (isPNG(file))
    ret renameFile_assertTrue(file, changeExtension(file, ".png"));
  ret file;
}

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1031273
Snippet name: fixImageFileName - e.g. rename to ".jpg" if it is actually a JPEG. actually renames the file
Eternal ID of this version: #1031273/4
Text MD5: 63927f43f57e4815414b39c63c383d5b
Transpilation MD5: 0af5c5c7c204efb6cba520ec37fbc171
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-08-09 03:09:53
Source code size: 272 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 166 / 249
Version history: 3 change(s)
Referenced in: [show references]