Skip to content

Commit 1d35b82

Browse files
committed
Add extensive README and LICENSE
1 parent bb3eefa commit 1d35b82

File tree

9 files changed

+508
-9
lines changed

9 files changed

+508
-9
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
# Godot 4+ specific ignores
22
.godot/
3+
export_presets.cfg

LICENSE.md

Lines changed: 373 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,126 @@
11
# SpeedCrop
2+
3+
Speedcrop is an application to quickly crop many images within a folder to a certain resolution. It is based on the [Godot Engine](https://godotengine.org/) (4.0) and supports the same formats the Engine supports for import and export (PNG, JPG, WEBP).
4+
5+
The main focus was providing a as fast as possible workflow for cropping images to a certain resolutiom while still remaining as simple as possible. After configuring the initial settings on the right, you can move forward on the left hand, while selecting the area with the right hand.
6+
7+
For more I suggest taking a look at the [Showcase](#showcase).
8+
9+
![Application preview](https://user-images.githubusercontent.com/18115780/213894048-d93189b7-4cb1-40b4-8f21-5a9789b9bf8a.png)
10+
11+
- [SpeedCrop](#speedcrop)
12+
- [Features](#features)
13+
- [Usage](#usage)
14+
- [Why](#why)
15+
- [Showcase](#showcase)
16+
- [Misc](#misc)
17+
- [SCONS config for the export templates](#scons-config-for-the-export-templates)
18+
- [Copyright and license information](#copyright-and-license-information)
19+
20+
## Features
21+
22+
* PNG, JPG, WEBP support
23+
* Lazy loading of images enabling browsing of large folders (I tried up to 20.000 images)
24+
* Rotate images by 90°
25+
* Remembers previous region when going back to an image
26+
* Threaded loading and saving of images so that the application remains as responsive as possible
27+
* Support for templating the output file name (more on that later)
28+
* Responsive UI which fits even on small screens
29+
* Written in basic GDScript using only engine features, so should be easy to understand and modify for people familiar with the engine
30+
31+
## Usage
32+
33+
If available, grab the latest release for your platform from the [releases page](https://github.com/NetroScript/SpeedCrop/releases). They are custom compiled versions of the export template to be as small as possible. Otherwise, you can download the source code and run it with the Godot Engine. I made it while Godot 4.0 was still in beta, so my provided binaries are built on top of commit `c3539b4561f9b4d7dc4ba1c5859217e7fbf9c6fe`.
34+
35+
Now just run the application. On the right side click the folder icon for `Input Path`, select your folder with the images you want to crop. Next select an output path. If you do not provide one, the current working directory will be used.
36+
37+
If you want you can modify the output file name template. This is a string which will be used to generate the output file name (and also folder structure). It can contain the following placeholders:
38+
39+
```
40+
{directory_tree} - The relative folder tree to the original image
41+
{file} - The filename (without extension)
42+
{extension} - The file extension
43+
{index} - The index the image had in this application
44+
{width} - The width at which it was cropped
45+
{height} - The height at which it was cropped
46+
{rotations} - How often the image was rotated (negative = counterclockwise, positive=clockwise)
47+
{rect.x} - The cropped area top left x position (in the original image)
48+
{rect.y} - The cropped area top left y position (in the original image)
49+
{rect.width} - How wide the cropped area originally was
50+
{rect.height} - How high the cropped area originally was
51+
```
52+
53+
By using `{directory_tree}` you can create a folder structure which mirrors the original folder structure. Alternatively you can leave it out and use `{index}` to create a flat folder structure without overwriting files. An example template could be `{directory_tree}/{file}_{width}x{height}.{extension}` for a more detailed name or also for a flat directory structure `{index}_{file}.{extension}`.
54+
55+
As a last setting you can select the output format. This is the format the cropped images will be saved as. It can be different from the input format. If you want to keep the original format, select `Same as input`.
56+
57+
Now you can go to cropping images. For that you have the following controls available (which you can also show within the application by pressing F1):
58+
59+
```
60+
Space / Right - Move to next image (Moving between images will save the cropped image to disk)
61+
Left - Move to previous image
62+
Q - Rotate image counterclockwise
63+
R - Rotate image clockwise
64+
ESC - Unfocus GUI element
65+
66+
Mouse in the main area:
67+
68+
Mouse Wheel - Zoom in / out at mouse position
69+
Right Click, Drag - Zoom in / out, x coordinate is a bit slower than y coordinate
70+
Left Click, Pan - Move the selected area
71+
72+
Mouse in the bottom area:
73+
74+
Mouse Wheel - Scroll through images
75+
Left Click - Select image
76+
```
77+
78+
And thats it already.
79+
80+
## Why
81+
82+
You might ask why I made something like that. This is because I personally needed many cropped images at a specific resolution. Sure web tools might exist with nice UI, but they aren't local, thus not as fast and don't have direct access to the filesystem.
83+
84+
There are also existing tools which are very good at cropping, but only specific stuff, where you would first need for example a feature detector. Something like this is mostly only easily available for faces for example. If this was your use case, a library like [autocrop](https://github.com/leblancfg/autocrop) is a much better choice than this application.
85+
86+
In any case this was a fun project to make and I hope it can be useful for someone else as well. And it was the first time I made something with Godot which is exclusively an application and not a game. Because of this I also provide the two exports with a more optimized executable size compared to the default export templates.
87+
88+
## Showcase
89+
90+
As demo images I used some tree images generated with Stable Diffusion here.
91+
92+
First have a video showing the application in action:
93+
94+
https://user-images.githubusercontent.com/18115780/213894630-54bdb299-1ea4-4109-adad-ab1542364571.mp4
95+
96+
The application is made quite responsively and should fit on every screen.
97+
98+
![Application scales freely](https://user-images.githubusercontent.com/18115780/213894696-05a49809-c3d5-4931-b7c8-17327e09e929.png)
99+
100+
Here you can see the info text you can toggle with F1.
101+
102+
![Controls displayed within the application](https://user-images.githubusercontent.com/18115780/213894721-bf2c6c20-bd49-43be-a6dd-a882db2b04fa.png)
103+
104+
## Misc
105+
106+
### SCONS config for the export templates
107+
108+
Should you be interested in the command I used to build the export templates, here it is:
109+
110+
```sh
111+
# Windows
112+
scons -j8 platform=windows target=template_release production=yes arch=x86_64 optimize=size use_lto=yes disable_3d=yes module_bmp_enabled=no module_astcenc_enabled=no module_zip_enabled=no module_xatlas_unwrap_enabled=no module_websocket_enabled=no module_webrtc_enabled=no module_vorbis_enabled=no module_upnp_enabled=no module_theora_enabled=no module_tga_enabled=no module_squish_enabled=no module_ogg_enabled=no module_multiplayer_enabled=no module_minimp3_enabled=no module_lightmapper_rd_enabled=no module_jsonrpc_enabled=no module_etcpak_enabled=no module_enet_enabled=no module_basis_universal_enabled=no
113+
114+
# Linux
115+
scons -j8 platform=linux target=template_release production=yes arch=x86_64 optimize=size use_lto=yes disable_3d=yes module_bmp_enabled=no module_astcenc_enabled=no module_zip_enabled=no module_xatlas_unwrap_enabled=no module_websocket_enabled=no module_webrtc_enabled=no module_vorbis_enabled=no module_upnp_enabled=no module_theora_enabled=no module_tga_enabled=no module_squish_enabled=no module_ogg_enabled=no module_multiplayer_enabled=no module_minimp3_enabled=no module_lightmapper_rd_enabled=no module_jsonrpc_enabled=no module_etcpak_enabled=no module_enet_enabled=no module_basis_universal_enabled=no
116+
117+
```
118+
119+
### Copyright and license information
120+
121+
This project is licensed under the MPL-2.0 license.
122+
123+
Following parts of the project are contained which are licensed under different licenses:
124+
The used Godot Engine itself, and the provided icons which were also used here and are provided in the `/assets/icons` folder. For specific details see the [copyright notice](https://github.com/godotengine/godot/blob/master/COPYRIGHT.txt) of the Godot Repository.
125+
126+
Additionally the contained font `Cantarell` is licensed under the OFL-1.1 license. For more information see the license file in the `/assets/fonts/cantarell` folder.

icon.icns

46.2 KB
Binary file not shown.

icon.ico

151 KB
Binary file not shown.

icon.png

54.3 KB
Loading

icon.svg.import renamed to icon.png.import

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22

33
importer="texture"
44
type="CompressedTexture2D"
5-
uid="uid://ukemnkhypln1"
6-
path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
5+
uid="uid://b17v0hb7yebn2"
6+
path="res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"
77
metadata={
88
"vram_texture": false
99
}
1010

1111
[deps]
1212

13-
source_file="res://icon.svg"
14-
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"]
13+
source_file="res://icon.png"
14+
dest_files=["res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"]
1515

1616
[params]
1717

@@ -32,6 +32,3 @@ process/hdr_as_srgb=false
3232
process/hdr_clamp_exposure=false
3333
process/size_limit=0
3434
detect_3d/compress_to=1
35-
svg/scale=1.0
36-
editor/scale_with_editor_scale=false
37-
editor/convert_colors_with_editor_theme=false

icon.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

project.godot

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,13 @@ config_version=5
1111
[application]
1212

1313
config/name="SpeedCrop"
14+
config/description="SpeedCrop is a Godot-based application for quickly cropping many images in a folder to a specific resolution with an intuitive user interface and support for various image file formats."
1415
run/main_scene="res://MainApplication.tscn"
1516
config/features=PackedStringArray("4.0", "Forward Plus")
16-
config/icon="res://icon.svg"
17+
run/low_processor_mode=true
18+
config/icon="res://icon.png"
19+
config/macos_native_icon="res://icon.icns"
20+
config/windows_native_icon="res://icon.ico"
1721

1822
[autoload]
1923

0 commit comments

Comments
 (0)