Solved

JPEG image problem

Posted on 2011-09-08
13
393 Views
Last Modified: 2012-05-12
I use TImage and JPEG components in Delphi to process image files (.jpg) (galerie.dll is "my" DLL when I do that stuff)
Everything is right except on a couple of such jpg files where I get an access violation
The stack trace is this
00fb00d3 +07b galerie.dll jpeg             jpeg_read_scanlines
00fae13d +315 galerie.dll jpeg             TJPEGImage.GetBitmap
00fadc7f +00b galerie.dll jpeg             TJPEGImage.Draw
00fa597a +02a galerie.dll Graphics         TCanvas.StretchDraw
When I "open" the jpg file with standard windows tool, it looks okay
0
Comment
Question by:LeTay
  • 7
  • 6
13 Comments
 
LVL 25

Expert Comment

by:epasquier
ID: 36502187
Please tell us which Delphi version you use, post the image, and why not a small project reproducing that same error
0
 

Author Comment

by:LeTay
ID: 36502209
Delphi 2009
Not a small project, unfortunately, and difficult to extract that part of it
I will run the application in debug to locate precisely on which instruction it fails, because what the stack trace shows is the place where my function is referenced
0
 
LVL 25

Expert Comment

by:epasquier
ID: 36502450
can't you create a small project with just one TImage (with the same properties as in your application) and load on a button the JPG that cause problems ?
Then you check that with such a simple app you have the problem as well, then you post everything (with the JPG file)
0
 

Author Comment

by:LeTay
ID: 36502525
Not easy, the TIMage is not on a form
We have a process, part of a large application that in fact resizes a set of JPEG (generally around 800 such files) and store resized JPEG (small size) in a database and in a (medium size) other directory, using a function call in one DLL that itself invokes another one etc...
My colleague will first debug it, it is easier to locate the guilty instruction
0
 
LVL 25

Expert Comment

by:epasquier
ID: 36502593
hum. So the TImage is not trying to load the original JPG file but a transformed one, by your dll ?
0
 

Author Comment

by:LeTay
ID: 36502632
Something like that
It worked for years ! (10 years, 10.000 images per year)
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

Author Comment

by:LeTay
ID: 36503418
Hello,
The line that creates the exception is this one :
     BMP.Canvas.StretchDraw(Rect(0,0,BMP.Width,BMP.Height),Temp.Picture.Graphic);
I attach the JPG file that creates the problem
I have another small program that asks for a JPEG file and displays is simply on a form
Running it on this JPG file creates also the exception
I think that the JPG file, even if correctly displayed with other tool, contains something that can't be easily "digested" by some Delphi component
It would of course be nice to have a fix (fixing the JPG file for example) but this is not a major problem for me as this is the first time it happens since almost 10 years
1010-1.jpg
0
 

Author Comment

by:LeTay
ID: 36503445
More .... I open the "guilty" JPEG file with Paint ... I save it like that ... I rerun the program ... it works on it !
0
 
LVL 25

Accepted Solution

by:
epasquier earned 500 total points
ID: 36507731
I confirm that I have the same problem with your image when I load it from an app compiled with D2007 (that I no longer have).

I'll try recompiling the app with Delphi XE, and see if something has changed. And if not, maybe try to understand a bit better what is happening.

But I'm afraid that the conclusion will be as you say : that is a one-in-a-million fluke caused by something not compliant with Delphi JPEG algo, and there is little chance for a fix. If that was worth it, you'll then have to try other JPEG componants/Lib to load the image. But I think it's not worth the trouble. Just make sure you handle the exception properly in your code and maybe log an error to tell someone to treat the file manually
0
 
LVL 25

Expert Comment

by:epasquier
ID: 36507749
I can load it with the new application compiled with Delphi XE...

Now you have yet another excuse to ask for an upgrade :o)
0
 

Author Comment

by:LeTay
ID: 36508658
Hello epasquier
I have Delphi 2009
What is Delphi XE ?
0
 
LVL 25

Expert Comment

by:epasquier
ID: 36510360
it's the new name for "Delphi 2011"

Now they released XE2 (2012). I haven't had a look at it yet, nor its features list.
0
 

Author Comment

by:LeTay
ID: 36510515
Many thanks and of course you get the points
0

Featured Post

Highfive Gives IT Their Time Back

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!

Join & Write a Comment

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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

743 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