Generate binary PPM files ("P6"). These are smaller on disk and faster to generate than text PPM files.
- stringPPM :: (Integer, Integer) -> [(Word8, Word8, Word8)] -> ByteString
- putPPM :: Handle -> (Integer, Integer) -> [(Word8, Word8, Word8)] -> IO ()
- writePPM :: FilePath -> (Integer, Integer) -> [(Word8, Word8, Word8)] -> IO ()
- fn_list :: ((Integer, Integer) -> (Word8, Word8, Word8)) -> (Integer, Integer) -> [(Word8, Word8, Word8)]
Documentation
stringPPM :: (Integer, Integer) -> [(Word8, Word8, Word8)] -> ByteStringSource
Given the image size (X pixels, Y pixels) and a list of pixel values (red, green, blue), produce a lazy ByteString containing the PPM data.
putPPM :: Handle -> (Integer, Integer) -> [(Word8, Word8, Word8)] -> IO ()Source
Convenience function: Generate PPM data and write it to the
specified Handle
. The handle is not closed or flushed afterwards.
This allows writing PPM data to network streams, etc. This function
does not return until all the data has been completely written.
(It may of course throw some kind of I/O exception instead.)
writePPM :: FilePath -> (Integer, Integer) -> [(Word8, Word8, Word8)] -> IO ()Source
Convenience function: Write PPM data directly to a file. If the file does not exist, it is created. If it exists, it is overwritten. This function does not return until the file has been completely created. (It may of course throw some kind of I/O exception instead.)