Skip to content

Instantly share code, notes, and snippets.

@supki
Created June 15, 2012 16:27
Show Gist options
  • Save supki/2937418 to your computer and use it in GitHub Desktop.
Save supki/2937418 to your computer and use it in GitHub Desktop.
Simple screenshot folding via repa library.
{-# LANGUAGE UnicodeSyntax #-}
module Main where
import Control.Applicative ((<$>))
import System.Directory (getDirectoryContents)
import System.FilePath ((</>))
import Data.Array.Repa.IO.DevIL
import qualified Data.Array.Repa as R
main ∷ IO ()
main = do
image_files ← map ("img" </>) . filter (`notElem` [".",".."]) <$> getDirectoryContents "img"
runIL $ do
images ← mapM readImage image_files
let xs = [R.transpose x | RGB x ← images]
z ← R.computeP $ R.transpose $ foldr1 (R.++) xs
writeImage "POLOTNISHE.png" $ RGB z
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment