I’ve got an image file with a jpg name but in reality it’s a psd file with an embedded jpg. I know how to recognize a jpg. But how do I do that with a psd file? I don’t need to know any details about the psd file. Just like I can do with a jpg
if StartOfPicture.MidB(6,4) = "JFIF" or StartOfPicture.MidB(6,4) = "Exif" then
'is jpg
I want to make sure that the file can be displayed. As usual plugin solutions are welcome.
@Jeff Tullin: that part of my code is working. I check if I can do a preview. If there is no preview then I get the icon for the file extension. But how do I get a preview for the file/data?
Only if Im trying to actually use it.
The file open dialog usually has a preview available.
I wouldn’t use that method if I was trying to write a ‘preview the contents of this folder’ application.
If you’re targeting the macOS only, you can use CGImageSource to read/create the preview, I’m pretty certain that you have the MBS plugin, so check with Christian on how to do. You can also use Spotlight to read the preview.
But my gut is telling me that this file is wrapped in some kind of container and the option I suggested may not work if that’s the case.
First my software tried to show this as text. Then after fixing this problem Graphics magic borked on the image. CGImageSource also doesn’t like the file. The image can be opened with GraphicsConverter but my software isn’t a graphics software. The user gets the file and I’ll close the ticket.