Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main( int argc, char* argv[] )
- {
- BMP ImageIn;
- const char* source = "1.bmp";
- ImageIn.ReadFromFile( source );
- int NewWidth = (int) ( ImageIn.TellWidth() * 2 / 100.0 );
- int NewHeight = (int) ( ImageIn.TellHeight() * 2 / 100.0 );
- BMP ImageOut;
- ImageOut.SetSize( NewWidth, NewHeight );
- if( ImageIn.TellBitDepth() == 32 )
- { ImageOut.SetBitDepth( 32 ); }
- else
- { ImageOut.SetBitDepth( 24 ); }
- for(int j=0 ; j <ImageOut.TellHeight() ; j++)
- {
- for(int i=0 ; i < ImageOut.TellWidth() ; i++)
- {
- RGBApixel Temp = GetPixel( ImageIn , i , ImageOut.TellWidth() , j , ImageOut.TellHeight() );
- *ImageOut(i,j) = Temp;
- }
- }
- int width = bmp.TellWidth( void );
- int height = bmp.TellHeight( void );
- char * oncearray = new char[width*height*3];
- for(int j = 0; j<height; j++)
- for(int i = 0; i<width, i++)
- {
- oncearray[j*width+i] = bmp.GetPixel(i,j);
- }
- //какая-то обработка массива onesarray
- for(int j = 0; j<height; j++)
- for(int i = 0; i<width, i++)
- {
- bmp.GetPixel(i,j) = oncearray[j*width+i];
- }
- // determine the output filename
- char * OutputName = "2.bmp";
- ImageOut.WriteToFile( OutputName );
Add Comment
Please, Sign In to add comment