                    poke (castPtr (d `plusPtr` (y*cs+x*fs))) (f v)
 
 
-instance  GetPixel (Image RGB D8) where
-    type P (Image RGB D8) = (D8,D8,D8)
-    {-#INLINE getPixel#-}
-    getPixel (x,y) i = unsafePerformIO $
-                        withGenImage i $ \c_i -> do
-                                         d <- {#get IplImage->imageData#} c_i
-                                         s <- {#get IplImage->widthStep#} c_i
-                                         let cs = fromIntegral s
-                                             fs = sizeOf (undefined :: D8)
-                                         r <- peek (castPtr (d`plusPtr` (y*cs +x*3*fs)))
-                                         g <- peek (castPtr (d`plusPtr` (y*cs +(x*3+1)*fs)))
-                                         b <- peek (castPtr (d`plusPtr` (y*cs +(x*3+2)*fs)))
-                                         return (r,g,b)
 
 
 convertTo :: CInt -> CInt -> BareImage -> BareImage

                                         s <- {#get IplImage->widthStep#} c_i
                                         let cs = fromIntegral s
                                             fs = sizeOf (undefined :: Float)
                                         r <- peek (castPtr (d`plusPtr` (y*cs +x*3*fs)))
                                         g <- peek (castPtr (d`plusPtr` (y*cs +(x*3+1)*fs)))
                                         b <- peek (castPtr (d`plusPtr` (y*cs +(x*3+2)*fs)))
                                         return (r,g,b)

instance GetPixel (Image LAB D32) where

                                         s <- {#get IplImage->widthStep#} c_i
                                         let cs = fromIntegral s
                                             fs = sizeOf (undefined :: Float)
                                         l <- peek (castPtr (d`plusPtr` (y*cs +x*3*fs)))
                                         a <- peek (castPtr (d`plusPtr` (y*cs +(x*3+1)*fs)))
                                         b <- peek (castPtr (d`plusPtr` (y*cs +(x*3+2)*fs)))
                                         return (l,a,b)

-- | Perform (a destructive) inplace map of the image. This should be wrapped inside
-- withClone or an image operation
