Skip to content

Instantly share code, notes, and snippets.

@supki
Created June 15, 2012 15:27
Show Gist options
  • Save supki/2937031 to your computer and use it in GitHub Desktop.
Save supki/2937031 to your computer and use it in GitHub Desktop.
Simple screenshot folding via gd library.
{-# LANGUAGE UnicodeSyntax #-}
module Main where
import Control.Applicative ((<$>))
import Data.List (foldr1)
import Graphics.GD (copyRegion, loadPngFile, newImage, savePngFile)
import System.Directory (getCurrentDirectory, getDirectoryContents)
import System.FilePath ((</>))
main ∷ IO ()
main = do
image_files ← map ("img" </>) . filter (`notElem` [".",".."]) <$> getDirectoryContents "img"
images ← mapM loadPngFile image_files
new_image ← newImage (1366 * length images, 768)
mapM (\(i,s) → copyRegion (0,0) (1366,768) s (1366 * i,0) new_image) $ zip [0..] images
savePngFile "POLOTNISHE.png" new_image
@dmalikov
Copy link

import Data.List (foldr1)
getCurrentDirectory

meemoh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment