Заготовка для генератора картинки

This commit is contained in:
2024-11-18 03:45:29 +03:00
parent 5711244be4
commit 54e266b899
2 changed files with 34 additions and 10 deletions

View File

@@ -4,9 +4,14 @@ import Codec.Picture
import qualified Data.Vector.Unboxed as VU
import Lib
caesarShift :: Int
caesarShift = 66
bitsPerByte :: Int
bitsPerByte = 1
main :: IO ()
main = do
inputText <- readFile "resources/biography.txt"
@@ -29,5 +34,8 @@ main = do
let img = convertRGB8 dynImg
let width = imageWidth img
let height = imageHeight img
let resultImage = generateImage (encodePixel 1 img encryptedTextBits) width height
let totalBits = width * height * 3 * bitsPerByte
let bitsPadded = encryptedTextBits VU.++ VU.replicate (totalBits - VU.length encryptedTextBits) 0
let resultImage = generateImage (encodePixel bitsPerByte img bitsPadded) width height
saveBmpImage "tmp/david.bmp" (ImageRGB8 resultImage)