Menu

#253 shape dictionary does not function consistently after using djvumake

djvulibre
closed
None
3
2015-04-13
2015-04-13
No

Hi. Love DjVu. Thank you for the use of this great product. I have been trying to make a DjVu document that makes full use of the compression technologies. I have been using DjVuDigital to reduce the fg colors and to bg subsample at level 12 (the help file indicates subsampling goes only to 6 in DjVuDigital, but it does go to 12--a good thing). I then take the same pdf source file and use your any2djvu server to generate a corresponding DjVu with a shape dictionary. Then I take djvuextract to isolate the compressed components. Then I use djvumake to bring together the fg (few colors), the bg (12 subsample), and the JB2 shared shape dictionary. Doing this generates a new DjVu file that is wonderfully smaller, considering its content, than an individual program can generate, but I get error messages in DjView as it asks for a dictionary. I tried a workaround by using the original any2djvu pages that relate to the 20-page dictionary every 20 pages. So pages 1,21,41...are original files, and all the others between are the "hybrid" files. This actually worked, in that the viewer rendered the hybrid pages nicely on-screen. But if one jumps quickly from, say, page 2 to page 46, the viewer does not render the pages and wants the dictionary. But if you back up to page 41, then the pages beyond do then appear and look accurate. Pages 1,21,41,etc. are always visible. It is as though the viewer must first read the on-screen dictionary-associated pages before rendering subsequent pages. Using djvudump seems to show a proper file structure, and I was careful to incorporate the INCL chunks. So I think I have followed the rules, and the shape dictionary itself renders pages accurately when the pages themselves appear, but perhaps there is one little trick I don't know in the special case of shape dictionaries.

Any suggestions are appreciated.

Thanks again, Leon, for this underappreciated and elegant product.

Stephen Jones
Toronto

Discussion

  • Janusz

    Janusz - 2015-04-13

    Perhaps djview4shapes can be of some help:

    https://bitbucket.org/mrudolf/djview-shapes
    https://bitbucket.org/jsbien/ndt/wiki/wyniki#!djview-for-shapes-przegladarka-ksztatow-znakow-a-shape-browser

    To say the truth, I'm not sure it still works/compiles on the present day systems, but you can try. It is a typical case of the result of a finished project with no means to maintain it.

     
    • Stephen Jones

      Stephen Jones - 2015-07-14

      Thank you for your advice, Janusz. I did not know about these programs.

      Leon recently pointed out the fact that I needed to place the INCL chunk ahead of the Sjbz chunk when encoding with djvumake. I did not know that the order of the chunks was important after creating the INFO chunk. The corrected order solved the problem.

      Thanks again,

      Stephen Jones

       
  • Leon Bottou

    Leon Bottou - 2015-04-13

    Please try the following change to djvumake.cpp.
    - L.

    cdleonb@fuji:~/djvulibre-3.5$ git diff
    diff --git a/tools/djvumake.cpp b/tools/djvumake.cpp
    index 0e94532..7dff088 100644
    --- a/tools/djvumake.cpp
    +++ b/tools/djvumake.cpp
    @@ -955,7 +955,7 @@ main(int argc, char argv)
    }
    else if (!dargv[i].cmp("INCL=",5))
    {
    - create_incl_chunk(iff, "INCL", GURL::Filename::UTF8(5+(const char
    )dargv[i]).fname());
    + create_incl_chunk(iff, "INCL", const char
    )GUTF8String(dargv[i].substr(5,-1)));
    flag_contains_incl = 1;
    }
    else if (!dargv[i].cmp("PPM=",4))

     
  • Leon Bottou

    Leon Bottou - 2015-04-13
    • status: open --> closed
     

Log in to post a comment.