Libraryless. Click here for Pure Java version (8890L/53K).
1 | static File cropToRightScreenInPlace(File imageFile, int width, int height default Int.MAX_VALUE) {
|
2 | if (!isFile(imageFile)) null; |
3 | |
4 | loading "Crop image file" {
|
5 | BufferedImage img = loadImage2(imageFile); |
6 | if (img.getWidth() <= width && img.getHeight() <= height) {
|
7 | print("Nothing to crop: " + imageFile);
|
8 | ret imageFile; |
9 | } |
10 | |
11 | img = clipBufferedImage(img, 0, 0, width, height); |
12 | File atticFile = appendToBaseFileName(imageFile, ".uncropped"); |
13 | renameFileVerbose(imageFile, atticFile); |
14 | saveImageVerbose(imageFile, img); |
15 | print("Image cropped to " + width + " pixels");
|
16 | ret imageFile; |
17 | } |
18 | } |
Began life as a copy of #1032762
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
| Snippet ID: | #1033523 |
| Snippet name: | cropToLeftScreenInPlace |
| Eternal ID of this version: | #1033523/1 |
| Text MD5: | 9e6ed02d42e144d4e61262e3d3dadb3b |
| Transpilation MD5: | cf747a737a858add8dba48c4614ebe2d |
| Author: | stefan |
| Category: | javax / io |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2021-10-31 02:38:47 |
| Source code size: | 653 bytes / 18 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 362 / 469 |
| Referenced in: | [show references] |