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

1  
static File fixImageFileName(File file) {
2  
  if (!isFile(file)) ret file;
3  
  
4  
  if (isJPEG(file))
5  
    ret renameFile_assertTrue(file, changeExtension(file, ".jpg"));
6  
  if (isPNG(file))
7  
    ret renameFile_assertTrue(file, changeExtension(file, ".png"));
8  
  ret file;
9  
}

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