News:

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

Loading png/jpg/gif images

Started by johnsa, May 04, 2011, 01:11:47 PM

Previous topic - Next topic

johnsa

Hey,

I've had a look at lippng, libjpg but was wondering if there were any other solutions to be able to load/process png/jpg files.
Firstly i don't want to have to ship 2/3 OTHER dll's with my code and the above libs don't allow me to process the image in memory. Basically I need to be able to have the image in memory (possibly received via web get) then extract the pixel data out into my own format/surface.

I started to look at rolling my own, but it means a) building a DEFLATE implementation then DCT etc all of which seem to have rather poor reference. The DCT is very well documented, but if you're going to write your own you want a really fast one, and thats where the reference gets dodgy in terms of using 2d vs multiple 1d DCT's, and the AAN algorithm and butterflies etc.
Plus it's an awful lot of work to simply load/handle some image files :)

Any thoughts?
Thanks
John

dedndave

the forum search tool is your friend   :P
i have seen several jpg viewers/converters
they always convert to bmp/dib for display, which is an easy format to work with as far as getting pixel data

there is also an example...
masm32\examples\exampl07\car

johnsa

Having the final in memory version as a dib/bmp is perfect. Thanks for that link, it seems like a cleaner solution for JPG specifically instead of libJPG. Now to see if theres something for PNG or if that lib has been updated.
I had a look at the GDI+ stuff but it only seems to work for file based loading, or if you have a stream derived from istream in memory which isn't really going to work well.

dedndave

this is Ernie Murphy's image library - with source
i think the functions are in masm32.lib   :P

anyways - he uses OLE
i suspect it will load a PNG image, as well - not sure
it looks like the hardest part is converting the filename to unicode - lol
he makes it look easy  :P

that "car" example is his - i wonder if that's his car 

qWord

Quote from: johnsa on May 04, 2011, 02:41:07 PMI had a look at the GDI+ stuff but it only seems to work for file based loading, or if you have a stream derived from istream in memory which isn't really going to work well.
well, you can also create it from bitmaps, dip bitmaps, device contexts and an DDraw Surfaces.
FPU in a trice: SmplMath
It's that simple!