| CyBook Gen3 PDF thumbnail images |
| Saturday, 26 January 2008 22:16 |
|
One drawback of the CyBook's PDF support is the missing metadata. For example, it simply does not display preview images of PDF files in the browser. However, when looking around a bit on the SD card, some files with the extension .t2b seem to be the right candidates. It turns out that they are 4-bit greyscale images of the size 144x96. Here is a listing of my pdftot2b:
Listing: pdftot2b
The purpose of the file palette.ppm is to give the dithering algorithm the codes of the four colours we want to use. I started with four equally spaced grey codes (0x00, 0x55, 0xaa, 0xff). It should lie in the same directory as the script file. The conversion performed in the lines 10–13 could of course be done by convert alone. However, the result of the dithering by means of djpeg was slightly more satisfactory. update (2008-01-29): Of course, the whole script can be used to generate thumbnails from any format that is supported by ImageMagick by adapting lines 10–13 and 26 appropriately. Here is a modified version of the script: t2b. |







