Page MenuHome

Refactor of Thumbnail Creation
Needs ReviewPublic

Authored by Harley Acheson (harley) on Nov 4 2020, 5:49 PM.

Details

Reviewers
None
Group Reviewers
User Interface
Summary

This is a bit of a refactor of thumbnail creation. There is no overlap between this and D9404 and D9397.

We create and save preview images of some types of files as small thumbnail images saved on the file system for later retrieval. We do so while following the "Thumbnail Managing Standard". This patch just cleans up the code related to this and extends it a bit further. The main function, thumb_create_ex(), is cleaned up, variables renamed, more early returns, etc to greatly simplify it.

One reason behind this standard is to "provide further information about a file in its thumbnail. Especially file size, image dimension or image type are often used in graphic programs. If the thumbnail provides such information it avoids any need to access the original file". Basically we want to know as much as possible about the target file without having to load it. So this patch extends that a bit more...

For example for Images, the thumbnails now contain the following PNG Metadata:

  • Software - "Blender"
  • Thumb::URI - [path to target file]
  • Description - "Thumbnail for [path]"
  • Thumb::MTime - Modified time of the target file (not of thumbnail)
  • Thumb::Image::Width - Width of the target image (not of thumbnail)
  • Thumb::Image::Height - Height of the target image (not of thumbnail)

This patch just adds the following extras to images:

  • X-Blender::Image::Planes
  • X-Blender::Image::Channels
  • X-Blender::Image::DPIX
  • X-Blender::Image::DPIY

For Video files this patch adds the following to the metadata that we already store:

  • Thumb::Video::Width
  • Thumb::Video::Height
  • Thumb::Video::Frames
  • Thumb::Video::FPS
  • Thumb::Video::Orientation
  • Thumb::Video::Duration

For Fonts this patch adds the following:

  • X-Blender::Font::Family
  • X-Blender::Font::Glyphs
  • X-Blender::Font::Bold
  • X-Blender::Font::Italic
  • X-Blender::Font::Monospaced

For Blend files this patch adds the follow:

  • X-Blender::Blend::Subversion
  • X-Blender::Blend::Minversion
  • X-Blender::Blend::Minsubversion
  • X-Blender::Blend::Build_hash
  • X-Blender::Blend::Fileflag
  • X-Blender::Blend::Globalf

But Blend files could contain (but does not do so in this patch) things such as these:

  • X-Blender::Blend::Objects
  • X-Blender::Blend::Faces
  • X-Blender::Blend::Triangles
  • X-Blender::Blend::Edges
  • X-Blender::Blend::Vertices
  • X-Blender::Blend::Lamps
  • X-Blender::Blend::Bones
  • ...

Diff Detail

Repository
rB Blender

Event Timeline

Harley Acheson (harley) requested review of this revision.Nov 4 2020, 5:49 PM
Harley Acheson (harley) created this revision.

Updated to current state of master, and also to include extra info about blend files.

Harley Acheson (harley) edited the summary of this revision. (Show Details)Nov 10 2020, 7:56 PM
Harley Acheson (harley) edited the summary of this revision. (Show Details)Nov 11 2020, 5:35 PM
Harley Acheson (harley) edited the summary of this revision. (Show Details)