RC8: images don't appear when imported

I tried to import some images into one of my projects using RC8 - they showed up as imported, but the images themselves were blank. Importing images worked properly in previous betas and RCs.

This issue is still occurring in RC9.

Issue is still happening in RC10. However it’s entirely dependent on the image in question, and I’m not sure why. :confused:

Some images might have the extension PNG, but internally they have JPG data due to wrong file extension upon saving from a web browser for example. This might cause troubles to the Image reader engine which expects one type of image, but indeed the image internally is totally different format. I would suggest resaving the failing images with an external image manipulation application to ensure proper file name extension. If this does not help, resave the images with a different extension. I would suggest changing between PNG <> JPG image types.

Wait, the image reader engine depends only upon the eternal filename to determine what type of image it is? That’s pretty insecure and open to potential vulnerabilities, Tiho. I hope this is being worked on that it will properly scan the image data and determine the image type from the actual data (safely protecting against malformed data, overflows, etc.)

@devinganger: Unfortunately it is the Qt engine which loads an image via file. From the file extension it deducts the plugin which should be used to load the image data from the file. If the JPEG plugin tries to load a PNG image data, obviously it will return an error, even if the file contains a valid PNG image data.

The solution to this problem is probably creating QImage from raw file data, which will pull the plugin based on file contents, but have not played with this. I just described the possible cause, which I have seen for failed imported images. At the end of the day the image file extension should match the image file contents. One should not expect animated GIF from renaming a JPEG file extension to GIF for example. Importing this renamed GIF into Scrivener will most likely fail, like the described use case above.

Ugh, that approach is not nearly robust enough in modern computing and I am surprised that Qt does it that way. Thanks for the explanation, though.