UTFTConverter-0.1.0.0: Processing popular picture formats into .c or .raw format in RGB565

LicenseMIT
MaintainerAlexander Isenko <alex.isenko@googlemail.com>
Safe HaskellNone
LanguageHaskell2010

Format.Converter

Description

Format.Converter exports the functions that create the .c or .raw files when the FilePath is given

Both pictureToRaw and pictureToC accept these picture formats

  • .gif
  • .png
  • .jpg / .jpe / .jpeg
  • .bmp
  • .tga

If it's not any of those formats, an error gets thrown If there is an error while decoding the pictures it gets printed out

Synopsis

Documentation

pictureToRaw :: FilePath -> FilePath -> IO () Source

pictureToRaw takes a picture, decodes it, parses every pixel to a 4 digit RGB565 hex and saves it to a file with the same name and a .raw extention in the specified directory

This function takes two arguments

  • first FilePath is the directory to save the file to
  • second FilePath is the filepath to the picture

Possible errors:

  • Can throw an error if the picture format is not supported
  • If there is an error while decoding the pictures the file gets skipped and an error message is printed out

Results:

If the conversion was successful, a message gets printed

cat_01_bmp_120x120.bmp --> cat_01_bmp_120x120.raw

Example usage: (assumed that the picture is in the directory where ghci was started)

λ> dir <- getCurrentDirectory
λ> pictureToRaw dir "cat_01_bmp_120x120.bmp"
cat_01_bmp_120x120.bmp --> cat_01_bmp_120x120.raw

pictureToC :: Platform -> FilePath -> FilePath -> IO () Source

pictureToC takes a picture, decodes it, parses every pixel to a 4 digit RGB565 hex, adds the header based on the desired platform and saves it to a file with the same name and a .c extention in the specified directory

This function takes three arguments

  • Platform is the desired platform to convert to
  • first FilePath is the directory to save the file to
  • second FilePath is the filepath to the picture

Possible errors:

  • Can throw an error if the picture format is not supported
  • If there is an error while decoding the pictures the file gets skipped and an error message is printed out

Results:

If the conversion was successful, a message gets printed

cat_01_bmp_120x120.bmp --> cat_01_bmp_120x120.c

Example usage: (assumed that the picture is in the directory where ghci was started)

λ> dir <- getCurrentDirectory
λ> pictureToC AVR dir "cat_01_bmp_120x120.bmp"
cat_01_bmp_120x120.bmp --> cat_01_bmp_120x120.c