Solved

Using TJPEGImage.Scale in Delphi 3

Posted on 2000-02-16
9
804 Views
Last Modified: 2008-03-03
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?

0
Comment
Question by:michaelhiggins
9 Comments
 
LVL 2

Expert Comment

by:aubs
ID: 2527493
Look in delphi\help\examples\jpeg

Good luck

Aubs
0
 

Author Comment

by:michaelhiggins
ID: 2527562
Thanks, but I do not have a folder in \examples called jpeg.


Michael
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 2527762
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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 3

Expert Comment

by:bryan7
ID: 2528197
he could better assign the jpg to a TImage so he can more easily handle it..
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 2528243
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
 
LVL 13

Accepted Solution

by:
Epsylon earned 200 total points
ID: 2533210
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
 

Author Comment

by:michaelhiggins
ID: 2534692
Thanks for your comments - I will try them out this weekend.

Michael
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 2543299
Any success?
0
 

Author Comment

by:michaelhiggins
ID: 2543625
Yes, It worked fine. Thanks

Michael

0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question