Libraryless. Click here for Pure Java version (7601L/45K).
static File cropToLeftScreenInPlace(File imageFile) { ret cropToLeftScreenInPlace(imageFile, screenWidth(), screenHeight()); } static File cropToLeftScreenInPlace(File imageFile, int width, int height default Int.MAX_VALUE) { if (!isFile(imageFile)) null; loading "Crop image file" { BufferedImage img = loadImage2(imageFile); if (img.getWidth() <= width && img.getHeight() <= height) { print("Nothing to crop: " + imageFile); ret imageFile; } img = clipBufferedImage(img, 0, 0, width, height); File atticFile = appendToBaseFileName(imageFile, ".uncropped"); renameFileVerbose(imageFile, atticFile); saveImageVerbose(imageFile, img); print("Image cropped to " + width + " pixels"); ret imageFile; } }
Began life as a copy of #1015317
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx
No comments. add comment
Snippet ID: | #1032043 |
Snippet name: | cropToLeftScreenInPlace |
Eternal ID of this version: | #1032043/4 |
Text MD5: | 37c215093ce4e7e658077f388b7ed5f4 |
Transpilation MD5: | d904407c34bf6f530b237421b05b9c59 |
Author: | stefan |
Category: | javax / io |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-08-30 03:41:44 |
Source code size: | 786 bytes / 22 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 140 / 259 |
Version history: | 3 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1032762 - cropToRightScreenInPlace |