Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

JPEG image problem

Posted on 2011-09-08
13
Medium Priority
?
401 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

704 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