Using TJPEGImage.Scale in Delphi 3

I want to use the scale feature of TJPEGImage to display a thumbnail image. However, I can't seem to get it to work, where ever I put it. Has anyone used this feature sucessfully?

michaelhigginsAsked:
Who is Participating?
 
EpsylonCommented:
Uses JPEG;

procedure TForm1.Button1Click(Sender: TObject);
var j: TJPEGImage;
    b: TBitmap;
begin
  b := TBitmap.Create;
  j := TJPEGImage.Create;
  j.LoadFromFile('spidersm.jpg');
  j.Scale := jsQuarter;
  b.Assign(j);
  Canvas.Draw(100, 100, b);
  j.Free;
  b.Free;
end;
0
 
aubsCommented:
Look in delphi\help\examples\jpeg

Good luck

Aubs
0
 
michaelhigginsAuthor Commented:
Thanks, but I do not have a folder in \examples called jpeg.


Michael
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
EpsylonCommented:
I'm not sure if all this works in Delphi 3 but give it a go.


Uses JPEG;

procedure TForm1.Button1Click(Sender: TObject);
var j: TJPEGImage;
    b: TBitmap;
begin
  b := TBitmap.Create;
  j := TJPEGImage.Create;
  j.LoadFromFile('spidersm.jpg');
  j.Scale := jsQuarter;
  b.Assign(j);
  Canvas.Draw(100, 100, b);
  j.Free;
  b.Free;
end;
0
 
bryan7Commented:
he could better assign the jpg to a TImage so he can more easily handle it..
0
 
EpsylonCommented:
That is a possibility.

  j := TJPEGImage.Create;
  j.LoadFromFile('spidersm.jpg');
  j.Scale := jsQuarter;
  Image1.Picture.Bitmap.Assign(j);
  j.Free;


It's just what you want to do with it...
0
 
michaelhigginsAuthor Commented:
Thanks for your comments - I will try them out this weekend.

Michael
0
 
EpsylonCommented:
Any success?
0
 
michaelhigginsAuthor Commented:
Yes, It worked fine. Thanks

Michael

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.