Open albfan opened 2 weeks ago
My only idea around this is detect if it creates a duplicate image (not sure how feasible that is) but guess the width and height for a raw file seems to be a common problem.
From source images on http://www.rinkydinkelectronics.com/library.php?id=53. Using raviewer as thumbnailer
UTFT_tinyFAT/Image-files
Some images choosing first guess incorrectly:
while other files just detect dimensions correctly:
It looks as though the problem you see is only visible for portrait images (i.e. correct height is larger than the correct width) and all horizontal images are detected properly. Is that assumption correct?
I don't think we have to detect whether the double images are the same (especially that they aren't, we just see odd lines on the left and even lines on the right). I think in case if the second predicted width is exactly two times smaller than the first one, we could make an assumption that the smaller one is always correct.
Alternatively (and this could be even better), we could try to give priority to dimensions with common aspect ratios. In the case of your input data 4:3 (or 3:4 for portrait mode - 240:320), would be much more common than the predicted 3:1 ratio (480x160).
Feel free to give it a go and experiment with some additional detection features
aspect ratio makes lot of sense, making a wrong guess on a unusual raw image format probably is not problematic
Will create some PR around that idea, and if is too specific we can wrap in a configurable parameter
This can be easily done with:
/usr/share/thumbnailers/raw.thumbnailers
/usr/bin/raviewer-thumbnailer
There're only two problems:
-w
or--width
image ends distorted.Using this diff we can inspect predicted widths and heights:
From this file:
pic104.zip
output is:
first guess looks incorrect:
Second one looks better: