Fix #107212: Fix file browser thumbnails for images #107515

Merged
Jesse Yurkovich merged 2 commits from deadpin/blender:fix-browser-thumbnails into main 2023-05-06 00:16:26 +02:00

Fix several issues found while investigating missing browser thumbnails.

TIFF, PSD, and PNG now use their old file check code. This is due to
OIIO not having an early-out check within .open. Calling .open
required a large portion of the file to be available (more than 8192
bytes). The code here can be removed in the future if/when a new API is
available which alleviates this problem.[1]

PSD files often carry along a large blob of ICCProfile metadata.
Attempting to roundtrip this metadata when we cache the thumbnail to
.png was leading to problems. We suppress this metadata now as ICC
profiles are not supported in general and are quite large.

Lastly, even after the mentioned new API is available, OIIO will want to
validate the full header of some file formats. DPX is the largest at a
full 2048 bytes so we must have this as our minimum now too. OS's should
be servicing this read call just as efficiently as when using 64. I
could spot no performance difference here at least.

This was missed during development because Blender will cache thumbnails
into a special .thumbnails directory and the images I was using to test
had already been cached there.


[1] I plan on submitting a PR to OIIO to allow their ImageInput::valid_file API to take in a memory proxy. If that is accepted we would gain two nice things:

  • We'd be able to once again remove the custom TIFF, PSD, and PNG header checks
  • It would be more efficient than calling .open like we do today for some of the other formats
Fix several issues found while investigating missing browser thumbnails. TIFF, PSD, and PNG now use their old file check code. This is due to OIIO not having an early-out check within `.open`. Calling `.open` required a large portion of the file to be available (more than 8192 bytes). The code here can be removed in the future if/when a new API is available which alleviates this problem.[1] PSD files often carry along a large blob of ICCProfile metadata. Attempting to roundtrip this metadata when we cache the thumbnail to .png was leading to problems. We suppress this metadata now as ICC profiles are not supported in general and are quite large. Lastly, even after the mentioned new API is available, OIIO will want to validate the full header of some file formats. DPX is the largest at a full 2048 bytes so we must have this as our minimum now too. OS's should be servicing this read call just as efficiently as when using 64. I could spot no performance difference here at least. This was missed during development because Blender will cache thumbnails into a special .thumbnails directory and the images I was using to test had already been cached there. ---- [1] I plan on submitting a PR to OIIO to allow their `ImageInput::valid_file` API to take in a memory proxy. If that is accepted we would gain two nice things: - We'd be able to once again remove the custom TIFF, PSD, and PNG header checks - It would be more efficient than calling `.open` like we do today for some of the other formats
Jesse Yurkovich added this to the Core project 2023-05-02 00:53:51 +02:00
Author
Member

@blender-bot build

@blender-bot build
Jesse Yurkovich force-pushed fix-browser-thumbnails from d9b4b30666 to 0aad8bf77a 2023-05-02 02:10:06 +02:00 Compare
Author
Member

@blender-bot build

@blender-bot build
Jesse Yurkovich force-pushed fix-browser-thumbnails from 0aad8bf77a to 39a1a7b7c1 2023-05-02 19:28:03 +02:00 Compare
Author
Member

@blender-bot build

@blender-bot build
Member

Although this passes far more of my tests, I still get failures on the attached 5 PNG files. These do pass on my PR #107661 though that just reverts us back to signature checking and remains reading just 64 bytes.

Reverting to signature checking (as this PR does for PSD and TIFF) and leaving the HEADER_SIZE at 64 seems like a safe fix for this.

Although this passes far more of my tests, I still get failures on the attached 5 PNG files. These do pass on my PR #107661 though that just reverts us back to signature checking and remains reading just 64 bytes. Reverting to signature checking (as this PR does for PSD and TIFF) and leaving the HEADER_SIZE at 64 seems like a safe fix for this.
Jesse Yurkovich added 1 commit 2023-05-05 22:31:32 +02:00
Member

Looks good! Works with all my test PNG files now. I did not test with PSD or TIFF, but assume you have.

Looks good! Works with all my test PNG files now. I did not test with PSD or TIFF, but assume you have.
Jesse Yurkovich merged commit 5cc8fea7e9 into main 2023-05-06 00:16:26 +02:00
Jesse Yurkovich deleted branch fix-browser-thumbnails 2023-05-06 00:16:29 +02:00
Howard Trickey referenced this issue from a commit 2023-05-29 02:51:42 +02:00
Bastien Montagne removed this from the Core project 2023-07-03 12:46:08 +02:00
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#107515
No description provided.