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!
Delphi

Avatar of undefined
Last Comment
Sinisa Vuk

8/22/2022 - Mon
David Favor

Just check the file extension for .png or .jpg/.jpeg + run the correct thumbnail generation code, per file extension.
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
Sinisa Vuk

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy