Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JPEG in an OpenPictureDialog 1

Status
Not open for further replies.

hennep

Programmer
Joined
Dec 10, 2000
Messages
429
When I click on a jpg, gif, tif file in an OpenPictureDialog the result is an error.
Can somebody tell how to open these files with the OpenPictureDialog.
So far only bmp seems to work.
 
Hello again :-)

You just need to #include <jpeg.hpp>

For Gif's you can try TGifImage by Anders Melander though I have not yet tried it with BCB6.

Modified verions

Original with extra documentation

The component is now also included in the Jedi-VCL library.
 
thanks again,

Hennie
 
Hi hennep

Sorry for taking so long to reply.

If you still happen to need a tip, when loading a jpeg into the TImage load it like so,

TJPEGImage *Jpeg = new TJPEGImage;
Graphics::TBitmap *Bmp=new Graphics::TBitmap();

//This line below only needed only if you had a Jpeg loaded using
//Image1->Picture->LoadFromFile(&quot;c:\\test.jpg&quot;);
Image1->Picture->Assign(NULL);

Jpeg->LoadFromFile(&quot;c:\\test.jpg&quot;);

Bmp->Assign(Jpeg);

TRect Rect( 0, 0, Bmp->Width, Bmp->Height);
Image1->Canvas->CopyRect(Rect,Bmp->Canvas,Rect);

This way the TImage thinks you actually have a TBitmap loaded.

There could be a better solution, if I find one I'll let you know.

:-)
 
Thank btecho,
this works perfect.

Hennep


With the TGifImage from Anders Melander I can also load gif image the same way:

//add Gifimage.pas to the project
#include &quot;Gifimage.hpp&quot;
TGIFImage*gif = new TGIFImage
Graphics::TBitmap *Bmp=new Graphics::TBitmap();
Image1->Picture->Assign(NULL);
gif->LoadFromFile(&quot;c:\\test.gif&quot;);
Bmp->Assign(gif);
TRect Rect( 0, 0, Bmp->Width, Bmp->Height);
Image1->Canvas->CopyRect(Rect,Bmp->Canvas,Rect);
 
But nobody write about TIFF. How I can open it or where i can find component to do it?
 
I have never even seen a tiff file. tiff is so 90's.
HA HA :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top