diff --git a/README.md b/README.md index 1e39d93..ae5f7b2 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 ``` diff --git a/examples/sierra-result.svg b/examples/sierra-result.svg index 0a6176b..0a0b1e0 100644 --- a/examples/sierra-result.svg +++ b/examples/sierra-result.svg @@ -1,3 +1,3 @@ \ No newline at end of file + "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> \ No newline at end of file diff --git a/src/Main.hs b/src/Main.hs index f05d785..3dfd708 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -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