I'm having abit of a brainfart and I can't quite grasp what I'm doing wrong.
It's quite simple, I am importing an image with FreeImage (http://freeimage.sourceforge.net/) which has a method FreeImage_GetBits
that returns a pointer to the first byte of the image data. I then try to load all the data into memory using (bitsperpixel / 8) * pixelsWidth ' pixelHeight, like this:
uint32_t bitsPerPixel = FreeImage_GetBPP(bitmap); // resolves to 24
uint32_t widthInPixels = FreeImage_GetWidth(bitmap); // resolves to 1024
uint32_t heightInPixels = FreeImage_GetHeight(bitmap); // resolves to 1024
// container is a std::vector<uint8_t>
pkgMaterial.mTextureData.insert(pkgMaterial.mTextureData.begin(), FreeImage_GetBits(bitmap), FreeImage_GetBits(bitmap) + ((bitsPerPixel/8) * widthInPixels * heightInPixels));
I have a jpg which is 31 kilobytes in size on disc. Yet when I load it using the above formelaformula, I see the vector is then filled with 3145728 bytes, which is approx 3145 kilobytes. What am I doing wrong?
Thanks