Loading and outputting .BMP images.
Posted: 2013-04-05T22:22:10-07:00
I recently got hold of a lot of binary images. The images are stored 128x128 bmp's and I would like to load them and save them as binary png's.
To start of I've taken the tutorial code :
The code compiles and runs but the outputtet bmp -> bmp, but the outputtet bmp claims to be have size 0x0, which does not seam right, since it has the same size(byte vise) as the original.
The code is run:
on this bmp image http://ge.tt/3SiPaDd/v/0?c
can someone please tell me what happens to the bmp when I load it and save it again -- it would aprear to me that some information goes missing
To start of I've taken the tutorial code :
Code: Select all
using namespace std;
int main(int argc,char **argv)
{
Magick::InitializeMagick(*argv);
try {
Magick::Image image;
// read the image from a file
image.read(argv[1]);
cout << "image: " << argv[1] << endl;
cout << image.columns() << endl;
cout << image.rows() << endl;
image.crop( Magick::Geometry(127, 127, 0, 0) );
// Write the image to a file
image.write( argv[2] );
}
catch( Magick::Exception &error_ ) {
cout << "Caught exception: " << error_.what() << endl;
return 1;
}
return 0;
}
The code is run:
Code: Select all
> convertbmp2bmp inputfile.bmp outputfile.bmp
can someone please tell me what happens to the bmp when I load it and save it again -- it would aprear to me that some information goes missing