2007.03.06 05:33 "[Tiff] load a jpeg in bitmap", by Enzo Costantini

2007.03.07 17:20 "Re: [Tiff] load a jpeg in bitmap", by Joris Van Damme

Enzo,

Is anybody who can tell me what I'd make to load a JPeg in a Bitmap using LibJPegFelphi?

There is no such thing as a LibJpegDelphi. The version of LibJpeg that accompanies LibTiffDelphi, is compiled specifically for this purpose. No attempt is made to be complete in what it exports and in its IO interface and all, other then what I needed in LibTiffDelphi. It is not intended to be used in any other way.

There is a version of LibJpeg that accompanies your Delphi distribution. Maybe you'll have better luck trying that one.

In addition, there are documents in the standard LibJpeg distribution that describe its usage. One such file is called 'libjpeg.doc'. Don't let the extension disgust you, it's a plain text file. Here you can learn how to use it.

I have imported the procedures

procedure jpeg_stdio_src(cinfo: PRJpegDecompressStruct; InStream: Pointer ); cdecl; external;

procedure jpeg_stdio_dest(cinfo: PRJpegCompressStruct; OutStream: Pointer ); cdecl; external;

and linked two object files:

{$L JpegObj\jdatasrc.obj}
{$L JpegObj\jdatadst.obj}

It's really not that simple. Borland doesn't support using statically linked C .obj files inside a Delphi project. (They do support the other way around, and of course they do support dynamic linking and such.) You can make it work, but you need a whole bag of tricks. Even the order in which you $L the (many more) different .obj files plays its part as that influences the linker (I get the impression the linker does one pass only through the stuff, links in what it already knows it needs, forgets about the rest, and if it needs any of that rest later on it reports trouble). And even if you get that right, there's compiler magic to resolve...

Stick with the pre-compiled LibJpeg distributed with Delphi, and you'll have none of those problems.

Best regards,

Joris Van Damme
info@awaresystems.be
http://www.awaresystems.be/
Download your free TIFF tag viewer for windows here:
http://www.awaresystems.be/imaging/tiff/astifftagviewer.html