Menu

#335 ddjvu: incorrect output in pdf and tiff formats

djvulibre
closed
nobody
None
5
2021-07-11
2021-06-11
Janusz
No

Enclose please find the files created with the commands:

ddjvu -verbose -format=tiff -page=19 -segment=112x42+431+965 Zaborowski_MBC.djvu tiff_test.tiff
ddjvu -verbose -format=pdf -page=19 -segment=112x42+431+965 Zaborowski_MBC.djvu pdf_test.pdf

You can reproduce them themselves as the document Zaborowski_MBC.djvu
is available at https://github.com/jsbien/Zaborowski-index4djview.

The PDF file is evidently distorted. The TIFF by most tools is displayed correctly, but it is also incorrect. In the thread
https://tug.org/pipermail/xetex/2021-June/027952.html
the following faults has been described of the file obtained by converting the TIFF output:

  • The image has different resolutions in the x- and y-directions (Heiko Oberdiek and others)
  • Resolution Unit: inches . Surely not! unless it needs ~100 units for the inch. Further down there are Pixel units of meters. (Ross Moore)

Fortunately the ppm output seems OK.

Best regards

Janusz

1 Attachments

Related

Bugs: #335

Discussion

  • Leon Bottou

    Leon Bottou - 2021-06-15

    Would that change do the trick?

    diff --git a/tools/ddjvu.cpp b/tools/ddjvu.cpp
    index e7b489b7..a7465a28 100644
    --- a/tools/ddjvu.cpp
    +++ b/tools/ddjvu.cpp
    @@ -486,9 +486,9 @@ render(ddjvu_page_t page, int pageno)
             TIFFSetField(tiff, TIFFTAG_IMAGEWIDTH, (uint32)rrect.w);
             TIFFSetField(tiff, TIFFTAG_IMAGELENGTH, (uint32)rrect.h);
             TIFFSetField(tiff, TIFFTAG_XRESOLUTION,
    -             (float)((dpi
    rrect.w+iw/2)/iw));
    +             (float)((dpiprect.w+iw/2)/iw));
             TIFFSetField(tiff, TIFFTAG_YRESOLUTION,
    -             (float)((dpi
    rrect.h+ih/2)/ih));
    +             (float)((dpi*prect.h+ih/2)/ih));
             TIFFSetField(tiff, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
             TIFFSetField(tiff, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
     # ifdef CCITT_SUPPORT

    On 6/11/21 12:47 AM, Janusz wrote:


    [bugs:#335] https://sourceforge.net/p/djvu/bugs/335/ ddjvu:
    incorrect output in pdf and tiff formats

    Status: open
    Group: djvulibre
    Created: Fri Jun 11, 2021 04:47 AM UTC by Janusz
    Last Updated: Fri Jun 11, 2021 04:47 AM UTC
    Owner: nobody
    Attachments:

    Enclose please find the files created with the commands:

    |ddjvu -verbose -format=tiff -page=19 -segment=112x42+431+965
    Zaborowski_MBC.djvu tiff_test.tiff|
    |ddjvu -verbose -format=pdf -page=19 -segment=112x42+431+965
    Zaborowski_MBC.djvu pdf_test.pdf|

    You can reproduce them themselves as the document Zaborowski_MBC.djvu
    is available at https://github.com/jsbien/Zaborowski-index4djview.
    https://github.com/jsbien/Zaborowski-index4djview.

    The PDF file is evidently distorted. The TIFF by most tools is
    displayed correctly, but it is also incorrect. In the thread
    https://tug.org/pipermail/xetex/2021-June/027952.html
    https://tug.org/pipermail/xetex/2021-June/027952.html
    the following faults has been described of the file obtained by
    converting the TIFF output:

    • The image has different resolutions in the x- and y-directions
      (Heiko Oberdiek and others)
    • Resolution Unit: inches . Surely not! unless it needs ~100 units
      for the inch. Further down there are Pixel units of meters. (Ross
      Moore)

    Fortunately the ppm output seems OK.

    Best regards

    Janusz


    Sent from sourceforge.net because you indicated interest in
    https://sourceforge.net/p/djvu/bugs/335/
    https://sourceforge.net/p/djvu/bugs/335/

    To unsubscribe from further messages, please visit
    https://sourceforge.net/auth/subscriptions/
    https://sourceforge.net/auth/subscriptions/

     

    Related

    Bugs: #335

  • Janusz

    Janusz - 2021-06-16

    Unfortunately after converting TIFFs to PNGs and using them in XeLaTeX I see the same (or very similar) problem. I haven't applied the patch myself but just pulled the code from the repository.

     

    Last edit: Janusz 2021-06-16
  • Leon Bottou

    Leon Bottou - 2021-07-11
    • status: open --> closed
     
  • Leon Bottou

    Leon Bottou - 2021-07-11

    Here the fix works on file Zaborowski_MBC.djvu.
    You mustn't have obtained the patch for some reason....

     

Log in to post a comment.