Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion JuicyPixels-blurhash.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ cabal-version: 1.18

name: JuicyPixels-blurhash
version: 0.1.0.3
synopsis: Blurhash is a very compact represenation of a placeholder for an image
synopsis: Blurhash is a very compact representation of a placeholder for an image
description: Please see the README on GitHub at <https://github.com/SamProtas/JuicyPixels-blurhash#readme>
category: Graphics, Image
homepage: https://github.com/SamProtas/JuicyPixels-blurhash#readme
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Blurhash is a very compact representation of a placeholder for an image.

This library provides a Blurhash encoding and decoding implementation based on the JuicyPixels representation of images.

For the full Blurhash sales pitch and algorithm explaination see either of:
For the full Blurhash sales pitch and algorithm explanation see either of:

- The website: <https://blurha.sh/>

Expand Down
2 changes: 1 addition & 1 deletion package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ extra-doc-files:


# Metadata used when publishing your package
synopsis: Blurhash is a very compact represenation of a placeholder for an image
synopsis: Blurhash is a very compact representation of a placeholder for an image
category: Graphics, Image

# To avoid duplicated efforts in documentation and dealing with the
Expand Down
2 changes: 1 addition & 1 deletion src/Codec/Picture/Blurhash.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
--
-- This library provides a Blurhash encoding and decoding implementation based on the JuicyPixels representation of images.
--
-- For the full Blurhash sales pitch and algorithm explaination see either of:
-- For the full Blurhash sales pitch and algorithm explanation see either of:
--
-- - The website: <https://blurha.sh/>
--
Expand Down
2 changes: 1 addition & 1 deletion src/Codec/Picture/Blurhash/Internal/DList.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
-- __Note__: This is an internal module not subject to PVP adherence.
module Codec.Picture.Blurhash.Internal.DList where

-- | A type alias for a Difference list for effecient appents
-- | A type alias for a Difference list for efficient appents
type DList a = [a] -> [a]

-- | Convert a list to a difference list
Expand Down
2 changes: 1 addition & 1 deletion src/Codec/Picture/Blurhash/Internal/Decode.hs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ decodePixel colors height width sizeY sizeX x y = foldl' acc (PixelRGBF 0 0 0)
let i' = realToFrac i
j' = realToFrac j
basis = cos (pi * x' * i' / width') * cos (pi * y' * j' / height')
-- Vector index safe in practice, convered by garbage data and property tests
-- Vector index safe in practice, covered by garbage data and property tests
PixelRGBF r' g' b' = colors V.! (i + j * sizeX)
in PixelRGBF (r + r' * basis) (g + g' * basis) (b + b' * basis)

Expand Down
6 changes: 3 additions & 3 deletions src/Codec/Picture/Blurhash/Internal/Encode.hs
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,21 @@ data EncodeError
encodeConfigDefault :: EncodeConfig
encodeConfigDefault = EncodeConfig 4 4

-- | A helper funciton to validate the provided encoding component count.
-- | A helper function to validate the provided encoding component count.
checkComponent :: Int -> Either EncodeError Int
checkComponent c
| c < 1 || c > 9 = Left InvalidComponents
| otherwise = pure c

-- | Encode a 'DynamicImage' to a blurhash. Calls 'encodeDynamicWithConfig' with 'encodeConfigDefault'.
--
-- Note: Relies on 'convertRGB8' before proceding with the standard Blurhash algorithm.
-- Note: Relies on 'convertRGB8' before proceeding with the standard Blurhash algorithm.
encodeDynamic :: DynamicImage -> Either EncodeError BS.ByteString
encodeDynamic = encodeDynamicWithConfig encodeConfigDefault

-- | Encode a 'DynamicImage' to a blurhash with a given an 'EncodeConfig'.
--
-- Note: Relies on 'convertRGB8' before proceding with the standard Blurhash algorithm.
-- Note: Relies on 'convertRGB8' before proceeding with the standard Blurhash algorithm.
encodeDynamicWithConfig :: EncodeConfig -> DynamicImage -> Either EncodeError BS.ByteString
encodeDynamicWithConfig config = encodeRGB8WithConfig config . convertRGB8

Expand Down