Libraryless. Click here for Pure Java version (8255L/50K).
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, img.getWidth()-width, 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 #1032043
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
| Snippet ID: | #1032762 |
| Snippet name: | cropToRightScreenInPlace |
| Eternal ID of this version: | #1032762/1 |
| Text MD5: | fc642e697d10da570456f0e7b6b5afba |
| Transpilation MD5: | 4e9dde8ed2ba39d03e22f3cd2ea74be6 |
| Author: | stefan |
| Category: | javax / io |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2021-10-04 17:07:32 |
| Source code size: | 672 bytes / 18 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 352 / 488 |
| Referenced in: | [show references] |