CyberPeter 13 Posted 2 hours ago c++Builder 12.2 I finished an implementation where I load pictures from a proprietary source into a TImage instance. Image->Picture->LoadFromStream(Stream) This works well and during testing I found I could render following file formats without a problem on my W11 development system bmp, jpg, png, wmf, emf, webp, gif, ico, tif, cr2, erf, raf, 3fr, dcr, dng, mrw, nef, orf, raw, pef, srw, sr2 However, while testing on older OS (VM) I noticed a lot of the fancier formats above do not work. Only the basic ones: bmp, jpg, png, wmf, emf, gif, ico and tif 1. I'm guessing TImage uses system installed resources to render images ? Which ones ? How does that work ? What do other applications install for TImage to be able to use them 2. Is there a way to get a list out of TImage that lists the supported files on the system the exe is running on ? Share this post Link to post
Uwe Raabe 2103 Posted 2 hours ago Calling GraphicFileMask(TGraphic) from Vcl.Graphics will give you a list of supported extensions. Share this post Link to post
Anders Melander 1929 Posted 2 hours ago The image formats that are missing on your "older OS" are the ones supplied by WIC (via the TWICImage class). TImage, or more precise TPicture, relies on different TGraphic implementations for image format support. The image formats you get by default, whether you like them or not, are the ones registered in the Graphics unit. Image formats are registered with TPicture.RegisterFileFormat and can be unregistered with TPicture.UnregisterFileFormat. The list of registered image formats is internal (private in the Graphics unit) and Embarcadero, in their infinite wisdom, has not provided us with any means of accessing or enumerating the list so the only info you can get about registered image formats are filename masks. See the TGraphic and TPicture documentation for more info. Share this post Link to post
Anders Melander 1929 Posted 2 hours ago I should mention that instead of relying on WIC, which is a library external to Delphi and thus outside your control, it would be better if you explicitly included/declared the image formats you want supported. For example, include the pngimage unit for PNG support, the jpeg unit for JPEG support, etc. I would also unregister the TWICImage class (see UnregisterFileFormat) as support for all the formats it support might not be a good thing. All the formats will just confuse your users. Share this post Link to post
CyberPeter 13 Posted 1 hour ago Thanks guys, I'll check it out tomorrow (signing off now, down under) > For example, include the pngimage unit for PNG support, the jpeg unit for JPEG support, etc. Is this not implied if I use TImage ? Since it supports those formats via the different graphics classes that it supports (png, bmp, jpg, wmf, ico) Share this post Link to post
Anders Melander 1929 Posted 1 hour ago > Is this not implied if I use TImage ? TImage is just a control that displays the data of a TPicture (TImage contains a TPicure object), so forget about TImage itself. None of the image formats, except maybe bmp/TBitmap, are "implied" by design. It has just gotten so that using the Graphics unit implicitly pulls in support for a lot of different image formats. But it's not because someone sat down and had deep thoughts about what image formats to support by default and how to do it. It just happened to end up that way because, I guess, there's nobody left at Embarcadero who gives a damn about these things. Not that I think there has ever been anyone there that understood graphics or cared about imaging. Share this post Link to post
Uwe Raabe 2103 Posted 54 minutes ago Vcl.Graphics internally registers the following extensions: tiff, tif, wmf, emf, ico and bmp. All other extensions are registered in the units the format is implemented: gif in Vcl.Imaging.GIFImg jpeg and jpg in Vcl.Imaging.jpeg png in Vcl.Imaging.pngimage svg, webp and wbmp in Vcl.Skia Only when these units are used in your application the corresponding file extensions will be supported. While designing in the IDE, these units are usually registered because the vclimg and the Skia packages are loaded. Share this post Link to post