square photo bug fix
This commit is contained in:
parent
e0d7d4d15b
commit
29b5b78d1a
3 changed files with 6 additions and 6 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
# image-triangles
|
# 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
|
### examples
|
||||||
<!--  -->
|
<!--  -->
|
||||||
|
|
@ -16,7 +16,7 @@ Makes a [voroni diagram](https://en.wikipedia.org/wiki/Voronoi_diagram) and fill
|
||||||
#### with nix
|
#### 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
|
#### with cabal
|
||||||
|
|
@ -24,6 +24,6 @@ Install [cabal & ghc](https://www.haskell.org/ghcup/) if you don't have them.
|
||||||
|
|
||||||
```
|
```
|
||||||
cabal update
|
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 |
|
|
@ -78,10 +78,10 @@ genImage' image gen cornerCount =
|
||||||
$ shape
|
$ shape
|
||||||
|
|
||||||
widthHeightRatio :: Double
|
widthHeightRatio :: Double
|
||||||
widthHeightRatio = (fromIntegral . fst $ dimensions) / (fromIntegral . snd $ dimensions)
|
widthHeightRatio = (fromIntegral . snd $ dimensions) / (fromIntegral . fst $ dimensions)
|
||||||
|
|
||||||
img' = convImage image
|
img' = convImage image
|
||||||
dimensions = Img.dims image
|
dimensions = uncurry (flip (,)) . Img.dims $ image
|
||||||
|
|
||||||
singleVoroni = last voroni
|
singleVoroni = last voroni
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue