This program takes in images of tiling wallpapers and extracts the tile from them. If you have ever found yourself enviously staring at someone’s cool tiling wallpaper, you can now extract it from a screenshot!
Given the file below, input.png
Running go run main.go
gives the following output.png
file:
Result of tiling it with feh --bg-tile output.png
:
Given the file below, screenshot.png
Running go run main.go -input screenshot.png -row-prefer-frequency -col-tolerance 40
gives the following output.png
file:
Result of tiling it with feh --bg-tile output.png
:
Given the file below, input.png
Running go run main.go -y-offset 400 -row-prefer-frequency -col-prefer-frequency -output tile.png
gives the following tile.png
file:
Result of tiling it with feh --bg-tile tile.png
:
Crop the screenshot so that any elements that are not a part of the tile get cropped out as far as possible. Horizontal and vertical status bars especially. You might still have some things left on the screen, in which case you can adjust the tolerance or pick the period based on frequency as seen in the second example. In case there’s something on the top or left of the image, you can adjust the x and y offsets to crop the final tile out of some other area, as seen in the third example.
JPG/JPEG detection does not work very well.
This program is licensed under the GNU General Public License, version 3 or later.