Author Topic: Thumbnail Types  (Read 3083 times)

0 Members and 1 Guest are viewing this topic.

Charlie Markwick

  • Member
  • **
  • Posts: 23
    • View Profile
Thumbnail Types
« on: 2014-10-21 04:52:01 »
I'm working on a project that allows me to put up a simple browser view of images that are managed by T+. In order to make sure I am able to display the thumbnail I need to understand how the thumbnail is stored as a BLOB.

In the T+ database the thumbnail type size etc is stored in a table called ThumbsPlusDatabase. There are 4 entries I would welcome help on:-

thumbnail_type
thumbnail_compress
alias
volume_match

Can anyone help?

Charlie

Daan van Rooijen

  • Administrator
  • Sr. Member
  • *****
  • Posts: 938
    • View Profile
Thumbnail Types
« Reply #1 on: 2014-10-21 16:10:01 »
I don't think you'll need those fields. The first two pertain to current thumbnailing settings (see lower left section of Options | Preferences | Thumbnails dialog) but your script will only have to work with whatever thumbnails you already have in your database, and the type of those is already known to you. From what I understand, the 'blobs' contain a JPEG or TIFF (LZH) stream. If you search the usenet postings that I mentioned earlier, you'll find several code examples for writing this data to usable image files.

The Alias and Volume_match fields in that table have no bearing on thumbnails.

PS: another possible approach might be to not read the thumbnails dynamically from the database, but to manually export the thumbnails to (countless little jpg) files and then use those in your application. See Thumbnail | Export to JPG files in TP9's menu. Of course, this would not be a good idea if you're still adding new images to the database, because then you'd have to export the thumbnails over and over again.
I'm volunteering as a moderator - I do not work for Cerious Software, Inc.

Charlie Markwick

  • Member
  • **
  • Posts: 23
    • View Profile
Thumbnail Types
« Reply #2 on: 2014-10-22 02:49:34 »
I don't want to have to run an export all the time so that's not a goer. I would like to make the script portable so anyone here can use it so I need to handle the thumbnail differently whether it's a tiff or a jpeg which is why I ask. Guess if I create a test DB I can see how those settings affect the values.

Daan van Rooijen

  • Administrator
  • Sr. Member
  • *****
  • Posts: 938
    • View Profile
Thumbnail Types
« Reply #3 on: 2014-10-22 05:39:18 »
Well, generally, all thumbnails in a database will be of the same format (unless you would change the setting at some point and then add new thumbnails without updating the old).

I found some additional but very dated info about thumbnail formats - this is from before JPG was added as an option, but it may still solve a riddle or two for the uncompressed and LZH-compressed formats:

>  o thumbnail_size is the length, in bytes, of the thumbnail data.
>
>  o thumbail_width and thumbnail_height are the dimensions.
>
>  o thumbnail_type is:
>    3 - Grayscale (32 levels)
>    4 - 8-bit color (236 indexed colors; values 0-9 and 246-255
>        are unused)
>    5 - 15-bit color
>    6 - 24-bit color (BGR order)
>
>  o thumbnail types of 259-262 are the LZH-compressed versions of
>    these types
>
>  o 8-bit thumbnails all use the same color table, which is not
>    stored in the database. You can obtain the palette by reducing
>    an image to the "ThumbsPlus palette." The color table of the
>    resulting file is the one used by T+ for the thumbnails.
>
>  o 15-bit thumbnails are stored as 5 bits each of blue, green and
>    red. The high-order bit is not used: 0rrrrrgggggbbbbb in binary.
>    In C/C++, you can convert to 24-bit RGB using:
>     r = ((pixel & 0x7c00) >> 7) | ((pixel & 0x7c00)) >> 13);
>     g = ((pixel & 0x03e0) >> 2) | ((pixel & 0x03e0)) >> 8);
>     b = ((pixel & 0x001f) << 3) | ((pixel & 0x001f)) >> 3);
>
>  o Grayscale thumbnails (which are used for grayscale images
>    regardless of the thumbnail type of the database in order to
>    reduce thumbnail size) are 32 gray levels, evenly spaced from
>    (0,0,0) through (255,255,255).
I'm volunteering as a moderator - I do not work for Cerious Software, Inc.

Charlie Markwick

  • Member
  • **
  • Posts: 23
    • View Profile
Thumbnail Types
« Reply #4 on: 2014-10-23 03:38:26 »
Thanks Daan