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!
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!
Just check the file extension for .png or .jpg/.jpeg + run the correct thumbnail generation code, per file extension.
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[]…µ†
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.