News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

m32lib bitmapfromfile - problem reading jpeg

Started by arya, July 19, 2009, 07:52:30 AM

Previous topic - Next topic

arya

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?

MichaelW

AFAIK the IPicture interface that BitmapFromFile depends on can handle only bitmaps, icons, and metafiles.
eschew obfuscation

Vortex


Vortex

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]

MichaelW

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.
eschew obfuscation

arya

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

donkey

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.


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.
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

Farabi

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.
Those who had universe knowledges can control the world by a micro processor.
http://www.wix.com/farabio/firstpage

"Etos siperi elegi"