Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/cel7t/TileEx

A Tiling Pattern Extractor written in Go
https://github.com/cel7t/TileEx

Last synced: 13 days ago
JSON representation

A Tiling Pattern Extractor written in Go

Awesome Lists containing this project

README

        

#+TITLE:TileEx - A Tiling Pattern Extractor written in Go
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!
* Usage Examples
** Trivial Case
Given the file below, ~input.png~

[[./Examples/example-1.png]]

Running ~go run main.go~ gives the following ~output.png~ file:

[[./Examples/output-1.png]]

Result of tiling it with ~feh --bg-tile output.png~:

[[./Examples/tileex-out-1.png]]
** When there's other things in the image
Given the file below, ~screenshot.png~

[[./Examples/example-2.png]]

Running ~go run main.go -input screenshot.png -row-prefer-frequency -col-tolerance 40~ gives the following ~output.png~ file:

[[./Examples/output-2.png]]

Result of tiling it with ~feh --bg-tile output.png~:

[[./Examples/tileex-out-2.png]]
** When there are things on the top left of the image
Given the file below, ~input.png~

[[./Examples/example-3.png]]

Running ~go run main.go -y-offset 400 -row-prefer-frequency -col-prefer-frequency -output tile.png~ gives the following ~tile.png~ file:

[[./Examples/output-3.png]]

Result of tiling it with ~feh --bg-tile tile.png~:

[[./Examples/tileex-out-3.png]]
* Usage Instructions
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.
* Caveats
JPG/JPEG detection does not work very well.
* License
This program is licensed under the GNU General Public License, version 3 or later.