Solved

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

Posted on 2012-03-16
8
1,836 Views
Last Modified: 2012-03-18
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
Comment
Question by:Dennis_Treacy
8 Comments
 
LVL 25

Expert Comment

by:Sinisa Vuk
Comment Utility
0
 
LVL 36

Expert Comment

by:Geert Gruwez
Comment Utility
or attach the jpeg so we can do some troubleshooting
0
 

Author Comment

by:Dennis_Treacy
Comment Utility
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
 
LVL 22

Expert Comment

by:Ferruccio Accalai
Comment Utility
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:Dennis_Treacy
Comment Utility
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
 

Author Comment

by:Dennis_Treacy
Comment Utility
File attached
ABB0054.jpg
0
 
LVL 22

Accepted Solution

by:
Ferruccio Accalai earned 500 total points
Comment Utility
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
 

Author Closing Comment

by:Dennis_Treacy
Comment Utility
Many thanks.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now