Click to See Complete Forum and Search --> : Image Size
CoolStar
May 23rd, 2006, 02:34 AM
Hi All,
I want to know the size of images which are in *.gif and *.png format.
Can some body tell me how can i acheive it?
Thanks in advance!!
golanshahar
May 23rd, 2006, 02:55 AM
Take a look at Image Class (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdicpp/GDIPlus/GDIPlusReference/Classes/Image.asp) of GDI+ :)
Cheers
CoolStar
May 23rd, 2006, 06:23 AM
It is not helping me out.
Can I know the Size of image?
golanshahar
May 23rd, 2006, 06:33 AM
It is not helping me out.
Can I know the Size of image?
It should help you out look here: Image::GetPhysicalDimension() (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdicpp/GDIPlus/GDIPlusReference/Classes/ImageClass/ImageMethods/GetPhysicalDimension.asp), scroll down there is Show Example link.
BTW this will return you the Width and the Height of the image, if you need the full image size you should get the bpp ( bits per pixel ) you can use the Image::GetPixelFormat() for that, and you need to multiply it for instance if pixel format is 24 bit image size will be:
Width*Height*3;
Cheers
CoolStar
May 23rd, 2006, 08:50 AM
Thanks for reply.
But I want to get the size of image without using MFC or SDK.
How can I implement the same in C++?
Can you please tell me which BYTE of binary binary blob of image contan
size of image? If I know which BYTE contain the size of Image then I can perform simple file operation to get the size of image.
If you have any other way yo achieve it please let me know.
golanshahar
May 23rd, 2006, 09:11 AM
Thanks for reply.
But I want to get the size of image without using MFC or SDK.
How can I implement the same in C++?
Can you please tell me which BYTE of binary binary blob of image contan
size of image? If I know which BYTE contain the size of Image then I can perform simple file operation to get the size of image.
If you have any other way yo achieve it please let me know.
Another way you can try is using the ::OleLoadPicture() api, look at this article (http://www.codeguru.com/cpp/g-m/bitmap/article.php/c4935/).
Cheers
philkr
May 23rd, 2006, 09:24 AM
Google for GIF file format and for PNG file format and you will find the exact specifications. Given the information there you will be able to open the files in binary mode and parse them for the resolution information.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.