Receives a file name, used in the transformer to note the new buffer. Exports multiple function that takes an array of buffer information from a bitmap and apply a transformation to that bitmap.
Parser -- accepts a buffer and will parse through it, according to the specification, creating object properties for each segment of the file
greyscale is a function that uses the parsed bitmap information from the parser to apply a transformation on the bitmap image changeing it from color to greyscale.
greyscale(pixelArray/colorArray)
pixelArray
{array} - the buffer array of pixel informationcolorArray
{array} - the buffer array of pixel color information
invert is a function that uses the parsed bitmap information from the parser to apply a transformation on the bitmap image inverting the colors.
invert(pixelArray/colorArray)
pixelArray
{array} - the buffer array of pixel informationcolorArray
{array} - the buffer array of pixel color information
punk is a function that uses the parsed bitmap information from the parser to apply a transformation on the bitmap image turning the blacks yellow and blue.
punk(pixelArray/colorArray)
pixelArray
{array} - the buffer array of pixel informationcolorArray
{array} - the buffer array of pixel color information
darken is a function that uses the parsed bitmap information from the parser to apply a transformation on the bitmap image making the entire image darker.
darken(pixelArray/colorArray)
pixelArray
{array} - the buffer array of pixel informationcolorArray
{array} - the buffer array of pixel color information
mirror is a function that uses the parsed bitmap information from the parser to apply a transformation on the bitmap image making the top half of the image mirror on the bottom half.
mirror(pixelArray/colorArray)
pixelArray
{array} - the buffer array of pixel informationcolorArray
{array} - the buffer array of pixel color information
flip is a function that uses the parsed bitmap information from the parser to apply a transformation on the bitmap image making it flip up-side-down.
flip(pixelArray/colorArray)
pixelArray
{array} - the buffer array of pixel informationcolorArray
{array} - the buffer array of pixel color information
- npm i
- CLI requires:
node index.js filepath-to-bitmap-image transformation-name
- transformation name option:
- greyscale
- invert
- punk
- darken
- flip
- mirror
- To run test in the CLI -
npm run test
- The following assertations were made:
- user enters one of the specified named transformations
- user enters a valid file path to a bmp image
- greyscale will remove the color from an image
- invert will invert the colors in the image
- punk will turn the blacks blue
- darken will darken the image
- mirror will reflect the top of the image on the bottom
- flip will turn the image up-side-down
- in the index.js, we declare a const [file, operation] = process.argv.slice(2);
- this is the variable that allows us to access the arguments entered in the CLI.
- process.argv[0] is process exec path
- process.argv[1] is the file path entered in the terminal
- proccess.argv[2] is the transformion operation specificed in the terminal