diff --git a/Data/Array/Repa/IO/DevIL.hs b/Data/Array/Repa/IO/DevIL.hs
new file mode 100644
--- /dev/null
+++ b/Data/Array/Repa/IO/DevIL.hs
@@ -0,0 +1,125 @@
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+
+-- |
+-- Module    : Data/Array/Repa/IO/DevIL.hs
+-- Copyright : (c) Don Stewart 2011
+--
+-- License   : BSD3
+--
+-- Maintainer: Don Stewart <dons00@gmail.com>
+-- Stability : provisional
+-- Portability: Repa interface to the DevIL image loading library.
+--
+-- Read and write images in many formats, representing them in Haskell
+-- as a 3-dimensional /repa/ array. Image parsing and decoding is done
+-- by the /Developers Image Library/, DevIL.
+--
+-- * Many formats are supported, including .png, .bmp, .jpg, .tif
+--
+-- * Image format parsing is determined by the filepath extension type.
+--
+-- Example: read a .png file into a 3D repa array, and write it out as a .jpg
+--
+-- > main = runIL $
+-- >          x <- readImage "/tmp/y.png" 
+-- >          writeImage "/tmp/x.jpg" x
+--
+-- Note that as DevIL is stateful, we ensure the library is initialized
+-- by running image manipulation functions in the /IL/ monad, a wrapper
+-- over IO that ensures the library has been initialized. It is a type
+-- error to call image functions outside of the /IL/ monad.
+--
+
+module Data.Array.Repa.IO.DevIL (
+
+    -- * The IL monad
+    runIL, IL,
+
+    -- * Image IO 
+    readImage, writeImage
+    
+    ) where
+
+-- transformers
+import Control.Monad.IO.Class (MonadIO(..))
+
+-- codec-image-devil
+import qualified Codec.Image.DevIL as D
+
+-- repa
+import qualified Data.Array.Repa as R
+import Data.Array.Repa
+
+-- base / arrays
+import Data.Array.Base
+import Data.Word
+
+------------------------------------------------------------------------
+
+-- | The IL monad. Provides statically-guaranteed access to an initialized IL context.
+newtype IL a = IL { unIL :: IO a }
+    deriving (Monad, MonadIO)
+
+-- | Running code in the /IL/ monad. This is a simple wrapper over /IO/
+-- that guarantees the DevIL library has been initialized before you run
+-- functions on it.
+--
+runIL :: IL a -> IO a
+runIL (IL a) = do
+    D.ilInit
+    a
+
+-- | Reads an image into an RGBA array. Indices are (row,column,color-channel).
+--
+-- Example:
+--
+-- > main = do
+-- >    x <- runIL $ readImage "/tmp/x.png"
+-- >    .. operations on x ..
+--
+--
+-- /Note:/ The image input type is determined by the filename extension. 
+--
+readImage  :: FilePath -> IL (R.Array DIM3 Word8)
+readImage f = do
+    uarr <- liftIO (D.readImage f) :: IL (UArray (Int, Int, Int) Word8)
+    return $! toRepa uarr
+
+-- | Writes an RGBA array to a file. Indices are the row, column, and color-channel.
+--
+-- /Note:/ The image output type is determined by the filename extension. 
+--
+writeImage :: FilePath -> R.Array DIM3 Word8 -> IL ()
+writeImage f a = do
+    liftIO $ D.writeImage f (fromRepa a)
+
+------------------------------------------------------------------------
+
+-- lazily stream an unboxed (3d) array to a repa array
+toRepa :: UArray (Int,Int,Int) Word8 -> R.Array DIM3 Word8
+toRepa uarr =
+    let ((ni,nj,nk),(mi, mj, mk)) = bounds uarr
+        (i,j,k) = (1 + mi - ni, 1 + mj - nj, 1 + mk - nk)
+        es      = elems uarr
+    in R.fromList (R.Z :. i :. j :. k) es
+
+-- lazily stream a repa array to an unboxed (3d) array
+fromRepa :: R.Array DIM3 Word8 -> UArray (Int,Int,Int) Word8
+fromRepa arr = 
+    let es = R.toList arr
+        (R.Z :. i :. j :. k) = extent arr
+    in listArray ((0,0,0), (i-1, j-1, k-1)) es
+
+{-
+
+TODO: O(1) conversion:
+
+toRepa uarr@(UArray l u n arr) = undefined
+
+    -- data UArray i e = UArray !i !i !Int ByteArray#
+
+    -- data Vector a = Vector {-# UNPACK #-} !Int
+                              {-# UNPACK #-} !Int
+                              {-# UNPACK #-} !ByteArray
+-}
+
diff --git a/Image/DevIL/Base.hsc b/Image/DevIL/Base.hsc
new file mode 100644
--- /dev/null
+++ b/Image/DevIL/Base.hsc
@@ -0,0 +1,205 @@
+{-# LANGUAGE CPP                        #-}
+{-# LANGUAGE ForeignFunctionInterface   #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+
+--------------------------------------------------------------------
+-- |
+-- Module    : Data/Array/Repa/IO/DevIL/Base.hsc
+-- Copyright : (c) Don Stewart 2011, Luke Palmer 2010.
+--
+-- License   : BSD3
+--
+-- Maintainer: Don Stewart <dons00@gmail.com>
+-- Stability : provisional
+--
+-- Raw FFI bindings to DevIL.
+--
+module Image.DevIL.Base (
+
+        -- * Types
+        ILImage ,
+        ILError ,
+
+        ILUInt,
+        ILSizei,
+        ILBoolean,
+        ILEnum,
+        ILInt,
+        ILUByte,
+
+        ImageName(..),
+
+        -- * Functions
+        ilInit,
+
+        -- * Values
+        il_type_unknown, il_bmp         , il_cut         , il_doom        , il_doom_flat   ,
+        il_ico         , il_jpg         , il_jfif        , il_ilbm        , il_pcd         ,
+        il_pcx         , il_pic         , il_png         , il_pnm         , il_sgi         ,
+        il_tga         , il_tif         , il_chead       , il_raw         , il_mdl         ,
+        il_wal         , il_lif         , il_mng         , il_jng         , il_gif         ,
+        il_dds         , il_dcx         , il_psd         , il_exif        , il_psp         ,
+        il_pix         , il_pxr         , il_xpm         , il_hdr         , il_icns        ,
+        il_jp2         , il_exr         , il_wdp         , il_vtf         , il_wbmp        ,
+        il_sun         , il_iff         , il_tpl         , il_fits        , il_dicom       ,
+        il_iwi         , il_blp         , il_ftx         , il_rot         , il_texture     ,
+        il_dpx         , il_utx         , il_mp3  
+
+        , il_no_error               , il_invalid_enum           , il_out_of_memory          
+        , il_format_not_supported   , il_internal_error         , il_invalid_value          
+        , il_illegal_operation      , il_illegal_file_value     , il_invalid_file_header    
+        , il_invalid_param          , il_could_not_open_file    , il_invalid_extension      
+        , il_file_already_exists    , il_out_format_same        , il_stack_overflow         
+        , il_stack_underflow        , il_invalid_conversion     , il_bad_dimensions         
+        , il_file_read_error        , il_file_write_error       , il_lib_gif_error          
+        , il_lib_jpeg_error         , il_lib_png_error          , il_lib_tiff_error         
+        , il_lib_mng_error          , il_lib_jp2_error          , il_lib_exr_error          
+        , il_unknown_error          
+
+    ) where
+
+import Foreign
+import Foreign.Ptr
+import Foreign.C.Types
+import Foreign.C.String
+
+#include "IL/il.h"
+
+-- Documentation from: <http://openil.sourceforge.net/docs/DevIL%20Manual.pdf>
+--
+-- You must initialize DevIL, or it will most certainly crash.  You need to
+-- initialize each library (il, ilu, and ilut) separately.  You do not need
+-- to initialize libraries you are not using, but keep in mind that the
+-- higher level libraries are dependent on the lower ones.  
+
+-- Design: an /unforgeable/ token (ala the mersenne-random package):
+
+------------------------------------------------------------------------
+-- Bindings
+
+-- Initialization 
+
+-- | Initialize DevIL. Must be done prior to other calls.
+ilInit :: IO ()
+ilInit = c_ilInit
+
+foreign import ccall "ilInit"
+    c_ilInit        :: IO ()
+
+foreign import ccall "ilOriginFunc"
+    c_ilOriginFunc  :: ILenum -> IO ILboolean
+
+foreign import ccall "ilEnable"
+    c_ilEnableC     :: ILenum -> IO ILboolean
+
+
+-- Names
+
+type ILUInt    = #type ILuint
+type ILSizei   = #type ILsizei
+type ILBoolean = #type ILboolean
+type ILEnum    = #type ILenum
+type ILInt     = #type ILint
+type ILUByte   = #type ILubyte
+
+-- | Image names are DevIL’s way of keeping track of images it is currently containing.  
+newtype ImageName = ImageName { fromImageName :: ILUInt }
+
+------------------------------------------------------------------------
+-- Enumeration types
+
+-- | Image types
+type ILImage = CInt
+
+-- Image types
+#{enum ILImage,
+  , il_type_unknown = IL_TYPE_UNKNOWN 
+  , il_bmp          = IL_BMP          
+  , il_cut          = IL_CUT          
+  , il_doom         = IL_DOOM         
+  , il_doom_flat    = IL_DOOM_FLAT    
+  , il_ico          = IL_ICO          
+  , il_jpg          = IL_JPG          
+  , il_jfif         = IL_JFIF         
+  , il_ilbm         = IL_ILBM         
+  , il_pcd          = IL_PCD          
+  , il_pcx          = IL_PCX          
+  , il_pic          = IL_PIC          
+  , il_png          = IL_PNG          
+  , il_pnm          = IL_PNM          
+  , il_sgi          = IL_SGI          
+  , il_tga          = IL_TGA          
+  , il_tif          = IL_TIF          
+  , il_chead        = IL_CHEAD        
+  , il_raw          = IL_RAW          
+  , il_mdl          = IL_MDL          
+  , il_wal          = IL_WAL          
+  , il_lif          = IL_LIF          
+  , il_mng          = IL_MNG          
+  , il_jng          = IL_JNG          
+  , il_gif          = IL_GIF          
+  , il_dds          = IL_DDS          
+  , il_dcx          = IL_DCX          
+  , il_psd          = IL_PSD          
+  , il_exif         = IL_EXIF         
+  , il_psp          = IL_PSP          
+  , il_pix          = IL_PIX          
+  , il_pxr          = IL_PXR          
+  , il_xpm          = IL_XPM          
+  , il_hdr          = IL_HDR          
+  , il_icns         = IL_ICNS          
+  , il_jp2          = IL_JP2           
+  , il_exr          = IL_EXR           
+  , il_wdp          = IL_WDP           
+  , il_vtf          = IL_VTF           
+  , il_wbmp         = IL_WBMP          
+  , il_sun          = IL_SUN           
+  , il_iff          = IL_IFF           
+  , il_tpl          = IL_TPL           
+  , il_fits         = IL_FITS          
+  , il_dicom        = IL_DICOM     
+  , il_iwi          = IL_IWI           
+  , il_blp          = IL_BLP           
+  , il_ftx          = IL_FTX           
+  , il_rot          = IL_ROT           
+  , il_texture      = IL_TEXTURE       
+  , il_dpx          = IL_DPX           
+  , il_utx          = IL_UTX           
+  , il_mp3          = IL_MP3           
+  , il_jasc_pal     = IL_JASC_PAL
+    }
+
+-- | Error Types
+type ILError = CInt
+
+#{enum ILError,
+    , il_no_error               = IL_NO_ERROR             
+    , il_invalid_enum           = IL_INVALID_ENUM         
+    , il_out_of_memory          = IL_OUT_OF_MEMORY        
+    , il_format_not_supported   = IL_FORMAT_NOT_SUPPORTED 
+    , il_internal_error         = IL_INTERNAL_ERROR       
+    , il_invalid_value          = IL_INVALID_VALUE        
+    , il_illegal_operation      = IL_ILLEGAL_OPERATION    
+    , il_illegal_file_value     = IL_ILLEGAL_FILE_VALUE   
+    , il_invalid_file_header    = IL_INVALID_FILE_HEADER  
+    , il_invalid_param          = IL_INVALID_PARAM        
+    , il_could_not_open_file    = IL_COULD_NOT_OPEN_FILE  
+    , il_invalid_extension      = IL_INVALID_EXTENSION    
+    , il_file_already_exists    = IL_FILE_ALREADY_EXISTS  
+    , il_out_format_same        = IL_OUT_FORMAT_SAME      
+    , il_stack_overflow         = IL_STACK_OVERFLOW       
+    , il_stack_underflow        = IL_STACK_UNDERFLOW      
+    , il_invalid_conversion     = IL_INVALID_CONVERSION   
+    , il_bad_dimensions         = IL_BAD_DIMENSIONS       
+    , il_file_read_error        = IL_FILE_READ_ERROR      
+    , il_file_write_error       = IL_FILE_WRITE_ERROR     
+    , il_lib_gif_error          = IL_LIB_GIF_ERROR  
+    , il_lib_jpeg_error         = IL_LIB_JPEG_ERROR 
+    , il_lib_png_error          = IL_LIB_PNG_ERROR  
+    , il_lib_tiff_error         = IL_LIB_TIFF_ERROR 
+    , il_lib_mng_error          = IL_LIB_MNG_ERROR  
+    , il_lib_jp2_error          = IL_LIB_JP2_ERROR  
+    , il_lib_exr_error          = IL_LIB_EXR_ERROR  
+    , il_unknown_error          = IL_UNKNOWN_ERROR  
+    }
+
diff --git a/LICENSE b/LICENSE
new file mode 100644
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,30 @@
+Copyright (c)2011, Don Stewart
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above
+      copyright notice, this list of conditions and the following
+      disclaimer in the documentation and/or other materials provided
+      with the distribution.
+
+    * Neither the name of Don Stewart nor the names of other
+      contributors may be used to endorse or promote products derived
+      from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/Setup.hs b/Setup.hs
new file mode 100644
--- /dev/null
+++ b/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/repa-devil.cabal b/repa-devil.cabal
new file mode 100644
--- /dev/null
+++ b/repa-devil.cabal
@@ -0,0 +1,63 @@
+Name:                repa-devil
+Version:             0.1
+Synopsis:            Support for image reading and writing of Repa arrays
+
+Description:         The repa-image library adds support for reading and
+                     writing images in many formats based on the DevIL
+                     open source image library. Image data is represented in Haskell
+                     as typed, multi-dimensional repa arrays.
+                     .
+                     Developer\'s Image Library (DevIL) is a library to
+                     develop applications with very powerful image
+                     loading capabilities, yet with a relatively simple
+                     interface. DevIL can load, save, convert,
+                     manipulate, filter and display a wide variety of
+                     image formats, including:
+                     . 
+                     * BMP, ICO, JPG, PNG, PNM, TGA, TIF, GIF, EXIF and many more.
+                     .
+                     /References:/
+                     .
+                     * <http://hackage.haskell.org/package/repa>
+                     .
+                     * <http://openil.sourceforge.net/>
+                     .
+                     * <http://www.haskell.org/haskellwiki/Numeric_Haskell:_A_Repa_Tutorial>
+
+Homepage:            http://code.haskell.org/~dons/code/repa-devil
+License:             BSD3
+License-file:        LICENSE
+Author:              Don Stewart
+Maintainer:          dons00@gmail.com
+Copyright:           Don Stewart (c) 2011
+Category:            Data Structures
+Build-type:          Simple
+Cabal-version:       >=1.6
+
+Library
+  Exposed-modules:     
+-- Note: future versions will use their own binding
+--    Image.DevIL.Base
+    Data.Array.Repa.IO.DevIL
+  
+  -- Packages needed in order to build this package.
+  Build-depends:       
+    base              >= 3   && < 5,
+    array             >= 0.3 && < 0.4,          
+    repa              >= 2   && < 2.1,
+    Codec-Image-DevIL >= 0.2 && < 0.3,
+    transformers      >= 0.2 && < 0.3
+  
+  Build-tools:
+    hsc2hs
+  
+  Extensions:
+    CPP,
+    ForeignFunctionInterface
+
+--  Extra-Libraries: IL
+
+source-repository head
+  type:     darcs
+  location: http://code.haskell.org/~dons/code/repa-devil
+
