I've encountered two issues when trying to display some aerial imagery data in QGIS and haven't managed to work out what the problem is. Frustratingly the issues only affect some tiles, and there doesn't appear to be anything obviously different between tiles that display fine and tiles that don't.
The two issues are:
- Some tiles do not display at all in QGIS e.g. sx6346.jpg
- Some tiles display, but have colourful horizontal lines across them e.g. sx6345.jpg.
In the screengrab above tile sx6346 is not displayed; tile sx6345 displays extraneous colourful lines. Adjacent tiles included to show that they display fine.
Regarding the extraneous colourful line issue there seems to be a threshold, which is different for each image, where they display fine at scales above a certain value. For example sx6345 displays fine at scale 1:19,845 and above, but has colourful lines across it at all scales below 1:19,845.
This threshold seems to be somehow linked to the size of the actual QGIS application window (if I make the QGIS window bigger, the image displays fine at all scales above 1:19,856).
QGIS displays the following errors for the above two issues:
- Unsupported Data Source: C:\Data\aerial_imagery\sx\sx6346.jpg is not a supported raster data source libjpeg: Bogus Huffman table definition
- Warning 1: libjpeg: Corrupt JPEG data: 285 extraneous bytes before marker 0xda [note: this error doesn't appear when adding the image to QGIS, but it does if you try and create a virtual raster catalog that includes the affected images (Raster > Miscellaneous > Build Virtual Raster Catalog...)]
The same images display fine in ArcGIS, MapInfo and in a range of image applications including GIMP, Paint and Paint Shop Pro. The above screen grabs are from the latest version of QGIS (2.16.1) but I’ve also tested them in multiple previous versions (including the current LTR 2.14.5) and unfortunately the behaviour is the same in all versions of QGIS.
The two error messages displayed in QGIS suggest problems with the source JPEG files, but given they work in every other package I've tried it appears that QGIS is being more rigorous in the code it's using to display JPEG's than everything else.
Using GDAL to do a JPEG to JPEG conversion resolves the problem but given we can't easily identify the affected files we'd have to process them all, which isn't practical given the number of files we have.
The two affected tiles can be downloaded from Dropbox.
Really, I'm asking if anyone has encountered anything like this before?
And do these issues sound like bugs in QGIS given the affected images work in every other package I've tried?