Link to home
Start Free TrialLog in
Avatar of Member_2_7965240
Member_2_7965240

asked on

Delphi : Png to Jpeg

Hello,

I use Delphi Seattle.
My customer loads pictures in database using Devexpress TcxImage component.
In this component they can "paste" pictures from a browser.

Later I need to make thumbnail picture of this. And this is the problem:

-my "thumbnail creation" procedure is for jpg image
-so it works well if it is a jpg but I get Jpeg error #53 if it is a png picture

Question: how can I detect at the beginning if it is a png picture (remember that I cannot know it if the customer uses paste from a browser) and how can I transform it in jpg image?

Thank you very much!
Avatar of David Favor
David Favor
Flag of United States of America image

Just check the file extension for .png or .jpg/.jpeg + run the correct thumbnail generation code, per file extension.
Avatar of Member_2_7965240
Member_2_7965240

ASKER

Hi,

In the database I store it as a blob field, so as I don't store the file name, just the picture itself.
A fragment of such a picture in the database:
˙Ř˙ŕJFIF˙ŰC (B+(%%(Q:=0B`Ued_U][jx™jqs[]…µ†
ASKER CERTIFIED SOLUTION
Avatar of Sinisa Vuk
Sinisa Vuk
Flag of Croatia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial