Feature #15: Invert colors

Transform the image so that colors are inverted (e.g., new_R = 255 - old_R).

Feature description

Transform the image so that colors are inverted (e.g., new_R = 255 - old_R).

Parameters value
name invert
Command -c color_invert
Input an image
output A new image image_out.bmp with inverted colors compared to the input image

Usage

./freud.exe -f images/input/image.jpeg -c color_invert

Output

A new image image_out.bmp with inverted colors compared to the input image

Describe tips for implementing feature

Use write_image_data from <estia-image.h> to create new image with the new values.

/**
 * Writes into an image file
 * @param[in] filename Name of the file to be written into
 * @param[in] data Reference to the pixel array to be written
 * @param[in] width Width of the image
 * @param[in] height Height of the image
 * @return 0 on failure and non-0 on success.
 */
int write_image_data(const char *filename, unsigned char *data, int width, int height);

Additional information

Example:

Input Output