From ffdf17c84ef5fb625fe70ed23753a11afcdae880 Mon Sep 17 00:00:00 2001 From: Mahdi Dibaiee Date: Sat, 4 Feb 2017 12:48:34 +0330 Subject: [PATCH] fix(resize): width and height were swapped accidentally :| --- picedit.cabal | 2 +- src/Data/Picture.hs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/picedit.cabal b/picedit.cabal index 0724312..dd32389 100644 --- a/picedit.cabal +++ b/picedit.cabal @@ -1,5 +1,5 @@ name: picedit -version: 0.2.2.0 +version: 0.2.3.0 synopsis: simple image manipulation functions description: Simple set of functions for image manipulation: contrast, brightnesss, rotation, etc. homepage: https://github.com/mdibaiee/picedit#readme diff --git a/src/Data/Picture.hs b/src/Data/Picture.hs index 65a64ce..6769d95 100644 --- a/src/Data/Picture.hs +++ b/src/Data/Picture.hs @@ -177,12 +177,12 @@ module Data.Picture ( Picture resize (sWidth, sHeight) (r, g, b, a) = (f r, f g, f b, f a) where initial = vector [0..fromIntegral sWidth * fromIntegral sHeight - 1] - (width, height) = (rows r, cols r) + (width, height) = (cols r, rows r) factor = 2 ^ 16 (xRatio, yRatio) = (width * factor `div` sWidth + 1, height * factor `div` sHeight + 1) - f m = tr $ reshape sWidth $ V.map replace initial + f m = reshape sWidth $ V.map replace initial where - v = flatten (tr m) + v = flatten m replace index = let (x, y) = (floor index `mod` sWidth, floor index `div` sWidth) (px, py) = (x * xRatio `div` factor, y * yRatio `div` factor) @@ -193,7 +193,7 @@ module Data.Picture ( Picture scale 1 p = p scale s (r, g, b, a) = resize (floor $ s * width, floor $ s * height) (r, g, b, a) where - (width, height) = (fromIntegral $ rows r, fromIntegral $ cols r) + (width, height) = (fromIntegral $ cols r, fromIntegral $ rows r) bound (l, u) x = max l $ min u x