square photo bug fix

This commit is contained in:
Jack Wines 2024-02-05 03:54:36 -08:00
parent e0d7d4d15b
commit 29b5b78d1a
No known key found for this signature in database
GPG key ID: 25B20640600571E6
3 changed files with 6 additions and 6 deletions

View file

@ -1,6 +1,6 @@
# image-triangles
Makes a [voroni diagram](https://en.wikipedia.org/wiki/Voronoi_diagram) and fills each cell with the average color the image below in. Please note, there's currently a bug, only square images will work. Additionally, some cells will be blank.
Makes a [voroni diagram](https://en.wikipedia.org/wiki/Voronoi_diagram) and fills each cell with the average color the image below in. Please note, there's currently a bug. Some cells will be blank.
### examples
<!-- ![Sierra mountains original](examples/sierra.jpg) -->
@ -16,7 +16,7 @@ Makes a [voroni diagram](https://en.wikipedia.org/wiki/Voronoi_diagram) and fill
#### with nix
```
nix run --experimental-features 'nix-command flakes' -- --cornerCount 800 --input examples/birds-eye-view.png --output output.svg
nix run --experimental-features 'nix-command flakes' -- --cornerCount 800 --input examples/birds-eye-view.webp --output output.svg
```
#### with cabal
@ -24,6 +24,6 @@ Install [cabal & ghc](https://www.haskell.org/ghcup/) if you don't have them.
```
cabal update
cabal run image-triangles -- --cornerCount 800 --input examples/birds-eye-view --output output.svg
cabal run image-triangles -- --cornerCount 800 --input examples/birds-eye-view.webp --output output.svg
```

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 2.1 MiB

After

Width:  |  Height:  |  Size: 696 KiB

Before After
Before After

View file

@ -78,10 +78,10 @@ genImage' image gen cornerCount =
$ shape
widthHeightRatio :: Double
widthHeightRatio = (fromIntegral . fst $ dimensions) / (fromIntegral . snd $ dimensions)
widthHeightRatio = (fromIntegral . snd $ dimensions) / (fromIntegral . fst $ dimensions)
img' = convImage image
dimensions = Img.dims image
dimensions = uncurry (flip (,)) . Img.dims $ image
singleVoroni = last voroni