How can I get the width and the heigh of my jpg file?

I have a jpg that I will load into my form, I would like to get the information of width and heigh, so that I can adjust my form according to its dimension.

Thanks
LVL 1
hidrauAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Lunda_ConstructionCommented:
Open the .jpg file in Microsoft Photo Editor and right click on it and go to properties.  It will tell you the size.
0
hidrauAuthor Commented:
No, I need to get the size through my program so that I can resize my window to the size of the my jpg.

Let me explain better

I have a jpg that I will be loaded into my form, in the component image.

But this jpg can diversify its size, that will only depend the way I record my jpg.
My form is 600 * 800 but if my jpg file is 500 * 500, then I need resize my form.

Did you get it?
0
Lunda_ConstructionCommented:
If I understand you need to lock the .jpg file into a size and position on the form.  

What software are you using to create the form.
0
Amazon Web Services

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

SteveBayCommented:
Here is a simple approach:
Uses Jpeg;
 
//---
 
procedure TForm2.MeasureJPG(FileName: String; var H, W: integer);
var Image : TImage;
begin
     Image := TImage.Create(Self);
     Image.AutoSize := True;
     Image.Picture.LoadFromFile(FileName);
     h := Image.Width;
     w := Image.Height;
     Image.Free;
end;

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
hidrauAuthor Commented:
thanks
0
SteveBayCommented:
Perhaps this is an even more simple approach
procedure TForm3.FormShow(Sender: TObject);
begin
     // After loading the image. 
     Image1.Align :=alNone;
     ClientHeight := Image1.Height;
     ClientWidth := Image1.Width;
     Image1.Align :=alClient;
end;

Open in new window

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.