I'm trying to add a filter to an image using the Haskell Image Processing package HIP, I was able to read the image using the ByteString Package and convert the image to type Image VS YCbCr Word8 using HIP. Now, how do I convert from Image VS YCbCr Word8 to Border (Pixel cs e) or Pixel cs e? I'm still learning Haskell so please keep it simple. see code below :
addFilterJpg :: FilePath -> IO ()
addFilterJpg fc = do
    case validPath fc of 
        Left err -> putStrLn err
        Right img -> do
            case readImage img of
                Left err -> putStrLn err
                Right img -> do
                  -- convert img::(Image VS YCbCr Word8) to Border (Pixel cs e)
                  -- apply filter
                  -- save image
                  putStrLn "Convolution Filter"
 
                        
There are a couple of issues with your question:
validPathfunction. I'll assume it does some file path validation, so I'll just ignore it in the answer.readImageis anIOaction, as such you can't just pattern match onEither, you need to execute it first.Some more image specific remarks:
This is what we get when we run it:
That being said, there are already functions built in that will simplify this whole process for you:
This is the outcome of the above function: