Hey all,
I have been programming in masm of and on for some time now.
Recently I used bitmapfromfile to read load jpeg images.It worked fine untill it had to read jpeg images taken from nokia mobile phone camera.
For these images it worked sometime and sometime it did not.And once it returned null for these images it did not read the regular jpeg images it was reading fine.Untill I restart the application.
The resolution of the images is 2592 x 1944
What could be wrong?
AFAIK the IPicture interface that BitmapFromFile depends on can handle only bitmaps, icons, and metafiles.
Hi arya,
Could you try the method below to load the jpeg file?
Displaying images with OLE functions (http://www.masm32.com/board/index.php?topic=10915.0)
Quote from: MichaelW on July 19, 2009, 08:14:58 AM
AFAIK the IPicture interface that BitmapFromFile depends on can handle only bitmaps, icons, and metafiles.
Hi MichaelW,
BitmapFromFile can handle JPGs ( masmlib.chm ) :
QuoteDescription
BitmapFromFile returns a bitmap handle from an image file.
An image may be in either .bmp, .gif, .jpg, or .wmf format
[attachment deleted by admin]
Hi Vortex,
Thanks for the information. It's strange that the PSDK and MSDN documentation does not seem to mention JPGs, but I was able to find this article (http://msdn.microsoft.com/en-us/magazine/cc301454.aspx).
Quote from: Vortex on July 19, 2009, 08:20:35 AM
Could you try the method below to load the jpeg file?
Hey,
Couldn't get enough time to test the code you pointed to.
But got another way of loading jpeg files.
Thanks anyway
Quote from: MichaelW on July 19, 2009, 09:36:17 AM
Hi Vortex,
Thanks for the information. It's strange that the PSDK and MSDN documentation does not seem to mention JPGs, but I was able to find this article (http://msdn.microsoft.com/en-us/magazine/cc301454.aspx).
I think this is because though you can load those images, only bitmaps, icons, and WMF files are actually natively supported by the IPicture interface, all other loadable images use a codec to translate them to bitmaps. For this reason you can have problems with certain features available in loadable formats such as transparency or auto-contrast adjustments. Even the newer GDI+ api simply uses codecs for different image types, though MS says it is for extensibility I think it may be because of patent issues, for example if for some reason MS loses the right to support JPG images they have simply to remove the codec from future versions as opposed to rewriting the GDI.
Quote from: arya on July 26, 2009, 10:19:18 AM
Quote from: Vortex on July 19, 2009, 08:20:35 AM
Could you try the method below to load the jpeg file?
Hey,
Couldn't get enough time to test the code you pointed to.
But got another way of loading jpeg files.
Thanks anyway
I used the read from memory version and it loaded the picture smoothly.