Page MenuHomePhabricator

Djvu thumbnailing should dynamically select PNG or JPG
Open, LowPublic

Description

Author: gmaxwell

Description:
We currently use JPG images for Djvu thumbnails. This works out when the Djvu is continous-tone, but when the Djvu is bi-tonal images jpeg creates ugly artifacts and is larger than a 1bpp png would be.

Continous tone djvu data are compressed with the c44 wavelet codec. Bitonal images are compressed with the djvu jb2 codec. Pages can also be mixed mode.

If a page contains no c44 elements we should thumbnail that page with png, otherwise we should use jpeg. If controling the type on a page by page basis is too hard, then a document wide setting (all pages jb2?) would still be an improvement over what we have today.

The djvu tools easily extract the needed data:

djvudump SchindlerHouse_plans.djvu

FORM:DJVM [315634] 
  DIRM [90]         Document directory (bundled, 5 files 5 pages)
  FORM:DJVU [77924] {SchindlerHouse00001a.djvu}
    INFO [10]         DjVu 4820x3792, v24, 78 dpi, gamma=2.2
    Sjbz [77894]      JB2 bilevel data
  FORM:DJVU [71590] {SchindlerHouse00002a.djvu}
    INFO [10]         DjVu 4820x3792, v24, 78 dpi, gamma=2.2
    Sjbz [71560]      JB2 bilevel data

...


Version: unspecified
Severity: enhancement

Details

Reference
bz11259