[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2317
  • 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 GruwezOracle 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
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
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

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

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