[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

JPEG image problem

Posted on 2011-09-08
13
Medium Priority
?
405 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
Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

 

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
 

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 2000 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

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
The video provides a quick and easy steps to migrate MBOX file to well known Outlook PST and Office 365. Besides this, it also supports and migrates more than 20 email clients of MBOX which include AppleMail, Opera, Thunderbird and SeaMonkey effortl…
Suggested Courses

591 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