How to load an arbitrary image from a BLOB stream into a TImage?

前端 未结 4 1327
攒了一身酷
攒了一身酷 2020-12-28 22:46

If I understand it correctly, TImage.LoadFromFile determines the type of picture from the file extension.

Is there any way to detect the image type auto

4条回答
  •  别那么骄傲
    2020-12-28 23:20

    In fact it is TPicture.LoadFromFile that detects file type, and it just uses the file extension. So you'll need to read the header of the stream to detect the file type.

    On the other hand, if you know what the format is when you put the BLOB into the database you could always include that information as your own private header to the BLOB.

提交回复
热议问题