I'm using a TImage component to load some png images, but some of them have the .imp
extension. I add the Vcl.Imaging.pngimage unit to my code and I'm using this code to load the images
if OpenDialog1.Execute then
Image1.Picture.LoadFromFile(OpenDialog1.FileName);
But when the LoadFromFile procedure is executed a exception is raised
Unknown picture file extension (.imp)
these images (.imp) are png files generated by an extenal app and are located in a read-only folder, so rename these files is not a option, the question is How I can load a Png image in a TImage component from a file which have another extension?
you must register the file format first using the TPicture.RegisterFileFormat
method
Try this
TPicture.RegisterFileFormat('imp','imp (png) image file',TPngImage);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With