guys,
I really want to know how i can process images in c++ (.bmp)
I really want to know how i can process images in c++ (.bmp)
#include <cstdio> #include <cstdlib> #include <iostream> using namespace std; #include "EasyBMP.h" int main( int argc, char* argv[] ) { if( argc < 3 ) { cout << "Correct usage: InvertColors <input.bmp> <output.bmp>" << endl; return -1; } // declare and read the image BMP Image; Image.ReadFromFile( argv[1] ); // do operations on the pixels for( int j=0; j < Image.TellHeight() ; j++ ) { for( int i=0; i < Image.TellWidth() ; i++ ) { Image(i,j)->Red = 255 - Image(i,j)->Red; Image(i,j)->Green = 255 - Image(i,j)->Green; Image(i,j)->Blue = 255 - Image(i,j)->Blue; } } // write the modified image Image.WriteToFile( argv[2] ); return 0; }
Comment