Contents

valeriyvan/swift-geometrize

## swift-geometrize

swift-geometrize

Swift package for recreating images using geometric primitives. It started as a Swift port of the C++ library geometrize-lib, but has since evolved in its own direction. You can try it out in the web version.

Usage

Look geometrize-cli target how package could be used to geometrize images.

Shape Comparison

The matrix below shows typical results for a combination of circles, triangles, rotated rectangles, rotated ellipses and all supported shapes at 50, 200 and 500 total shapes:

| | 50 Shapes | 200 Shapes | 500 Shapes | | ------------------ | ------------- | ------------- | ------------ | | Circles | [Chicken 50 Circles] | [Chicken 200 Circles] | [Chicken 500 Circles] | | Triangles |[Chicken 50 Triangles] | [Chicken 200 Triangles] | [Chicken 500 Triangles] | | Rotated Rectangles | [Chicken 50 RotatedRectangles] | [Chicken 200 RotatedRectangles] | [Chicken 500 RotatedRectangles] | | Rotated Ellipses | [Chicken 50 RotatedEllipses] | [Chicken 200 RotatedEllipses] |[Chicken 500 RotatedEllipses] | | All Shapes | [Chicken 50 All Shapes] | [Chicken 200 All Shapes] | [Chicken 500 All Shapes] |

Geometrizebot

You could try swift-geometrize in action in Telegram bot Geometrizebot which is also written in Swift and open-sourced.

TODO:

  • ✅ add stroke width for line, polyline and bezier curve;
  • ✅ multithreading;
  • add polygon as shape type;
  • filling shapes with gradient;
  • solve dealing with randomness in tests;
  • geometrize with predefined or user supplied brush strokes;
  • geometrize with characters (on output will be something which could be called ascii art or art produced by James Cook Type Writer Artist);
  • photo mosaic;
  • string art: 1, 2, 3, 4;
  • tape art: 1, 2, 3, 4, 5, 6.

License

Licensed under MIT license.

Support My Work

<div style="display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 20px;"> <div style="flex: 1; min-width: 250px;"> <h3>Bitcoin</h3> <p><code>1Van83aVMRbHoAHEagpSk8oxj6RwTXD6o</code></p> <img src="https://github.com/valeriyvan/valeriyvan.github.io/blob/main/assets/images/bitcoin-qr.png" alt="Bitcoin QR Code" style="width: 180px; height: 180px;"> </div> <div style="flex: 1; min-width: 250px; text-align: center;"> <h3>Buy Me a Coffee</h3> <a href="https://www.buymeacoffee.com/valeriyvan" target="_blank"> <img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;"> </a> </div> </div>

Package Metadata

Repository: valeriyvan/swift-geometrize

Default branch: main

README: README.md