""" ============================================================================= Demo 2.1's automatic removal of embedded thumbnails in images rotated for display as in-page elements. Without this removal, 4 images, all shot on a Galaxy Note 9, were displayed askew (tilted) as thumbnails by macOS Finder after thumbspage rotations. With removals, they all are displayed correctly and right-side up in Finder, and the same as they do in thumbspage galleries. It's unknown if other cameras and tools exhibit this issue, but seems likely given the vagaries of image encodings (see also UPDATE ahead). Specifics: the demo's 4 failing images in thumbspage 2.0 are: - 2018-12-26__151203 - 2019-07-24__163341 - 2019-07-24__164444 - note09-port All 4 also had incorrectly coded SceneType tags, but this was independent of thumbnail skew (some working images also had invalid SceneTypes). In total, the demo uses 22 images taken on 6 devices: - A Sony digital camera (HX50V) - An iPod - A Pixel 4a - And a Galaxy Note 9, Note 10+, and Note20 Ultra Of these 6, 3 devices did not produce an embedded thumb recognized by the piexif library (the Pixel, Note 10+, and Note 20 Ultra), and 3 devices did (the Sony, iPod, and Note 9). Of the latter 3, only the Note 9's camera yielded skewed Finder results post thumbspage rotation. Though full certainty is impossible, Finder apparently uses the embedded thumb directly if present, and there is something about the Note 9's encoding of it that differs from others and throws the Finder display off. Since predicating thumbnail removal on device type is not tenable, and changing embedded thumbs is too much extra work, 2.1 opts to delete embedded thumbs altogether to skirt this issue in full. This mod can be disabled in user_configs.py, but is enabled as a preset default. If disabled, originals images, including their embedded thumbnails, can be restored from ".original" backups if tools skew thumbs of rotated images. ---- UPDATE: later research showed that the skewed-thumbs issue varied widely by file explorer. Among the 11 tested: - Thumbs were skewed in 4: macOS Finder, iOS Files, and 2 of 7 Android file explorers (Total Commander and ASUS File Manager) - Thumbs were not skewed in 7: Windows Explorer, Linux Nautilus (a.k.a. Files), and 5 of 7 Android file explorers (Cx File Explorer, Solid Explorer, FX, Root Explorer, and Samsung My Files) - None of these 11 file explorers display skewed thumbs after the 2.1 fix to drop embedded thumbnails on rotation It was also discovered that other cameras and images were impacted (though tools may have added thumbnails to photos after they were shot); and the set of skewed thumbs varied in some explorers (details omitted for space). But all images were displayed correctly after rotation with 2.1's fix. Naturally, the large market shares of Windows and Android may have helped mask the issue in the past. For completeness, iOS's recent Files file explorer skewed some thumbs, though fewer than Finder; it also stretched some weirdly, and is almost too limited in scope to be included in the set. ============================================================================= """ # # 2.1's new results (with removals) # ~/Desktop/temp/delthumbs$ py3 $C/thumbspage/thumbspage.py tp21-res Clean thumbs folder [y or n] (enter=y)? Thumbs per row [int] (enter=4)? Thumb max size [x, y] (enter=(100, 100))? Use image-viewer pages [y or n] (enter=y)? Running Making thumbnail: tp21-res/_thumbspage/2019-07-24__DSC04700.JPG Skipping: ipod-1-land.HEIC Skipping: .DS_Store Making thumbnail: tp21-res/_thumbspage/2019-07-24__DSC04704.JPG --Reorienting tilted image --Note: embedded thumbnail was deleted Making thumbnail: tp21-res/_thumbspage/2018-12-26__151203.jpg --Reorienting tilted image --Note: bad SceneType Exif tag type was corrected --Note: embedded thumbnail was deleted Making thumbnail: tp21-res/_thumbspage/2019-07-22__DSC04541.JPG Making thumbnail: tp21-res/_thumbspage/2018-12-12__DSC03997.JPG --Reorienting tilted image --Note: embedded thumbnail was deleted Skipping: _thumbspage Making thumbnail: tp21-res/_thumbspage/note10-port.jpg --Reorienting tilted image Making thumbnail: tp21-res/_thumbspage/ipod-2-port.JPG --Reorienting tilted image --Note: embedded thumbnail was deleted Making thumbnail: tp21-res/_thumbspage/2019-07-24__163341.jpg --Reorienting tilted image --Note: bad SceneType Exif tag type was corrected --Note: embedded thumbnail was deleted Making thumbnail: tp21-res/_thumbspage/2018-12-12__DSC03996.JPG Making thumbnail: tp21-res/_thumbspage/note10-land.jpg Making thumbnail: tp21-res/_thumbspage/ipod-2-land.JPG Making thumbnail: tp21-res/_thumbspage/note09-port.jpg --Reorienting tilted image --Note: bad SceneType Exif tag type was corrected --Note: embedded thumbnail was deleted Making thumbnail: tp21-res/_thumbspage/note09-land.jpg Making thumbnail: tp21-res/_thumbspage/note20-port.jpg --Reorienting tilted image --Note: bad SceneType Exif tag type was corrected Making thumbnail: tp21-res/_thumbspage/2021-01-09__20210109_194135 copy.jpg Making thumbnail: tp21-res/_thumbspage/note20-land.jpg Making thumbnail: tp21-res/_thumbspage/2019-07-24__DSC04654.JPG --Reorienting tilted image --Note: embedded thumbnail was deleted Skipping: ipod-1-port.HEIC Making thumbnail: tp21-res/_thumbspage/pixel-land.jpg Making thumbnail: tp21-res/_thumbspage/2019-07-24__164444.jpg --Reorienting tilted image --Note: bad SceneType Exif tag type was corrected --Note: embedded thumbnail was deleted Making thumbnail: tp21-res/_thumbspage/pixel-port.jpg --Reorienting tilted image Generating thumbnails index page Generating view page for: 2018-12-12__DSC03996.JPG Generating view page for: 2018-12-12__DSC03997.JPG Generating view page for: 2018-12-26__151203.jpg Generating view page for: 2019-07-22__DSC04541.JPG Generating view page for: 2019-07-24__163341.jpg Generating view page for: 2019-07-24__164444.jpg Generating view page for: 2019-07-24__DSC04654.JPG Generating view page for: 2019-07-24__DSC04700.JPG Generating view page for: 2019-07-24__DSC04704.JPG Generating view page for: 2021-01-09__20210109_194135 copy.jpg Generating view page for: ipod-2-land.JPG Generating view page for: ipod-2-port.JPG Generating view page for: note09-land.jpg Generating view page for: note09-port.jpg Generating view page for: note10-land.jpg Generating view page for: note10-port.jpg Generating view page for: note20-land.jpg Generating view page for: note20-port.jpg Generating view page for: pixel-land.jpg Generating view page for: pixel-port.jpg Finished: see the results in the images folder, "tp21-res". # # 2.0's former results (no removals) # ~/Desktop/temp/delthumbs$ py3 $C/thumbspage/_private/thumbspage-full-package--2.0-nov0720-POSTFINAL/thumbspage.py tp20-res Clean thumbs folder [y or n] (enter=y)? Thumbs per row [int] (enter=4)? Thumb max size [x, y] (enter=(100, 100))? Use image-viewer pages [y or n] (enter=y)? Running Making thumbnail: tp20-res/_thumbspage/2019-07-24__DSC04700.JPG Skipping: ipod-1-land.HEIC Skipping: .DS_Store Making thumbnail: tp20-res/_thumbspage/2019-07-24__DSC04704.JPG --Reorienting tilted image Making thumbnail: tp20-res/_thumbspage/2018-12-26__151203.jpg --Reorienting tilted image --Note: bad SceneType Exif tag type was corrected Making thumbnail: tp20-res/_thumbspage/2019-07-22__DSC04541.JPG Making thumbnail: tp20-res/_thumbspage/2018-12-12__DSC03997.JPG --Reorienting tilted image Skipping: _thumbspage Making thumbnail: tp20-res/_thumbspage/note10-port.jpg --Reorienting tilted image Making thumbnail: tp20-res/_thumbspage/ipod-2-port.JPG --Reorienting tilted image Making thumbnail: tp20-res/_thumbspage/2019-07-24__163341.jpg --Reorienting tilted image --Note: bad SceneType Exif tag type was corrected Making thumbnail: tp20-res/_thumbspage/2018-12-12__DSC03996.JPG Making thumbnail: tp20-res/_thumbspage/note10-land.jpg Making thumbnail: tp20-res/_thumbspage/ipod-2-land.JPG Making thumbnail: tp20-res/_thumbspage/note09-port.jpg --Reorienting tilted image --Note: bad SceneType Exif tag type was corrected Making thumbnail: tp20-res/_thumbspage/note09-land.jpg Making thumbnail: tp20-res/_thumbspage/note20-port.jpg --Reorienting tilted image --Note: bad SceneType Exif tag type was corrected Making thumbnail: tp20-res/_thumbspage/2021-01-09__20210109_194135 copy.jpg Making thumbnail: tp20-res/_thumbspage/note20-land.jpg Making thumbnail: tp20-res/_thumbspage/2019-07-24__DSC04654.JPG --Reorienting tilted image Skipping: ipod-1-port.HEIC Making thumbnail: tp20-res/_thumbspage/pixel-land.jpg Making thumbnail: tp20-res/_thumbspage/2019-07-24__164444.jpg --Reorienting tilted image --Note: bad SceneType Exif tag type was corrected Making thumbnail: tp20-res/_thumbspage/pixel-port.jpg --Reorienting tilted image Generating thumbnails index page Generating view page for: 2018-12-12__DSC03996.JPG Generating view page for: 2018-12-12__DSC03997.JPG Generating view page for: 2018-12-26__151203.jpg Generating view page for: 2019-07-22__DSC04541.JPG Generating view page for: 2019-07-24__163341.jpg Generating view page for: 2019-07-24__164444.jpg Generating view page for: 2019-07-24__DSC04654.JPG Generating view page for: 2019-07-24__DSC04700.JPG Generating view page for: 2019-07-24__DSC04704.JPG Generating view page for: 2021-01-09__20210109_194135 copy.jpg Generating view page for: ipod-2-land.JPG Generating view page for: ipod-2-port.JPG Generating view page for: note09-land.jpg Generating view page for: note09-port.jpg Generating view page for: note10-land.jpg Generating view page for: note10-port.jpg Generating view page for: note20-land.jpg Generating view page for: note20-port.jpg Generating view page for: pixel-land.jpg Generating view page for: pixel-port.jpg Finished: see the results in the images folder. ~/Desktop/temp/delthumbs$