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

18
LINES

< > BotCompany Repo | #1015317 // jpegify - convert image file to JPEG

JavaX fragment (include)

static File jpegify(File imageFile, bool makeBackup default true) {
  if (isJPEGFile(imageFile)) ret imageFile;
  loading "JPEGify" {
    BufferedImage img = loadImage2(imageFile);
    File destFile = replaceExtension(imageFile, ".jpg");
    File atticFile = makeBackup ?
      newFile(javaxDataDir("JPEGified original pictures"), imageFile.getName()) : null;
    if (makeBackup)
      atticFile = makeFileNameUnique(atticFile);
    saveJPGVerbose(destFile, img);
    if (makeBackup)
      moveFileVerbose(imageFile, atticFile);
    else
      deleteFile(imageFile);
    print("Conversion done.");
    ret destFile;
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gjtlkbvenryc, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1015317
Snippet name: jpegify - convert image file to JPEG
Eternal ID of this version: #1015317/10
Text MD5: fd6fddf2ec9fe16f5816b7630348de1c
Author: stefan
Category: javax / io
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2024-10-06 21:42:38
Source code size: 638 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 708 / 684
Version history: 9 change(s)
Referenced in: [show references]