Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2381
  • Last Modified:

Delphi - Error when loading 96dpi jpeg file into Image.Picture

I can load a 72dpi jpeg file into TImage using  

Image.Picture.LoadFromFile(FileName);

but not a 96dpi jpeg file.

If I change the code to the following, I get the same result  

      jpeg:= TJpegImage.Create;
      jpeg.LoadFromFile(filename);
      Image.Picture.Graphic := jpeg;

What changes do I need to make for 96 dpi images?

I use Delphi XE. Thanks
0
Dennis_Treacy
Asked:
Dennis_Treacy
1 Solution
 
Sinisa VukCommented:
0
 
Geert GOracle dbaCommented:
or attach the jpeg so we can do some troubleshooting
0
 
Dennis_TreacyAuthor Commented:
I have attached one of the offending jpeg files. An exception error, JPEG Error #53, occurs at

    jpeg.LoadFromFile(filename);

Google search indicates #53 may be a memory issue - not much help really.
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
Ferruccio AccalaiSenior developer, analyst and customer assistance Commented:
I can't see any attached file here.
Anyway #53 usually means that the jpeg file is corrupted. Have you downloaded it from internet? If so it could be not 100% downloaded, so there's not a correct file end that generates the out of memory error on reading it.

Someone tells that he solved this issue using TADVPicture from TMS Software (I don't have it installed, so I don't know if it's true).

Try reopening the file in Photoshop or some other Image tool and re-save it, Or if you have downloaded it just try downloading it again.
0
 
Dennis_TreacyAuthor Commented:
The file was emailed to me by a client (student photos from a school). I can load them into Excel so I don't believe they are corrupted. Once I submit this comment I will try attaching again. Having some trouble doing that - getting a request for file description?
0
 
Dennis_TreacyAuthor Commented:
File attached
ABB0054.jpg
0
 
Ferruccio AccalaiSenior developer, analyst and customer assistance Commented:
Well, that's a PNG file renamed to JPG. In fact also Photoshop CS have matters trying to open it. It says "Invalid JPEG marker type is found". Reading the header of the file you can see a PNG marker. That's why the TImage.Picture fails loading it as a JPEG.
0
 
Dennis_TreacyAuthor Commented:
Many thanks.
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.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now