Чтение изображения с JuicyPixels

This commit is contained in:
2024-11-17 20:48:05 +03:00
parent d9076f7dfa
commit abb078e1b6
3 changed files with 17 additions and 4 deletions

View File

@@ -1,5 +1,6 @@
module Main (main) where module Main (main) where
import Codec.Picture
import Lib import Lib
caesarShift :: Int caesarShift :: Int
@@ -19,3 +20,11 @@ main = do
putStrLn $ take 30 encryptedTextFromBits putStrLn $ take 30 encryptedTextFromBits
let decryptedText = decryptCaesar alphabet caesarShift encryptedTextFromBits let decryptedText = decryptCaesar alphabet caesarShift encryptedTextFromBits
putStrLn $ take 30 decryptedText putStrLn $ take 30 decryptedText
readImageResult <- readImage "resources/david.bmp"
case readImageResult of
Left err -> putStrLn $ "Ошибка при чтении изображения: " ++ err
Right dynImg -> do
let img = convertRGB8 dynImg
putStrLn $ "Ширина: " ++ show (imageWidth img)
putStrLn $ "Высота: " ++ show (imageHeight img)

View File

@@ -34,7 +34,8 @@ library
src src
ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints
build-depends: build-depends:
base >=4.7 && <5 JuicyPixels
, base >=4.7 && <5
default-language: Haskell2010 default-language: Haskell2010
executable lab3-exe executable lab3-exe
@@ -47,7 +48,8 @@ executable lab3-exe
app app
ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N
build-depends: build-depends:
base >=4.7 && <5 JuicyPixels
, base >=4.7 && <5
, lab3 , lab3
default-language: Haskell2010 default-language: Haskell2010
@@ -62,6 +64,7 @@ test-suite lab3-test
test test
ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N
build-depends: build-depends:
base >=4.7 && <5 JuicyPixels
, base >=4.7 && <5
, lab3 , lab3
default-language: Haskell2010 default-language: Haskell2010

View File

@@ -21,6 +21,7 @@ description: Please see the README on GitHub at <https://github.com/gith
dependencies: dependencies:
- base >= 4.7 && < 5 - base >= 4.7 && < 5
- JuicyPixels
ghc-options: ghc-options:
- -Wall - -Wall