Menu

#264 Frames around DjVuPhotos not as clean as with Bitonals

djview
closed
5
2015-12-30
2015-12-30
No

Hi Leon, and Holiday Greetings,

Recently I have been creating modified photos in GIMP that have a frame with black rounded corners
and black borders (the rounded rectangle option and the border option). These images look fine when
converted to ppms, pngs, tiffs, or pdfs. I then have tried to create corresponding DjVu photos with c44 in DjVuLibre and in MiniDjVuPlus.

One gets artifacts of extra "ghost" lines and smudges along the frame as seen when zooming.
Using different dpi's and other options do not seem to help. But when I create such a frame as a 1-bit tiff
and add it as a background watermark to a text-based pdf (PDFill Tools) and then submit the pdf to Any2DjVu, or, if I use DjVu Bitonal in DjVuLibre with other source-image formats, the results are fine.

DjVuBitonal is fine with it; but DjVuPhoto is not.

The included attachment has the desired bitonal look of the frame on page 1. The frame is in the foreground layer. Subsequent pages show the way I may wish to present information as a framed text page and then as a photo page that needs the same clean frame. It would be nice if the photo pages had the same clean look to their frames as the text pages' frames have. But I cannot seem to get this to occur.

Note that the text pages are 600dpi and the photos are 200dpi, properly scaled.
They look orderly in a side-by-side view.

Ideally, it would be nice to simply place, in a batch conversion, a clean DjVu foreground frame into a collection of same-sized Djvu photos.

Three different workarounds were tried, in attempting to segment things. (informed guesswork...)

1) Use gsdjvu and --threshold=100 to make a good-looking framed-photo pdf look fine as a DjVu framed photo. The frame would not go into the foreground.

2) Use djvuextract and djvumake to merge the frame JB2 chunk (page 1) Sjbz and a photo background chunk BG44. DjVumake said that it could not find the (c44-based) background chunk subsample number. So I twice used gsdjvu to make a DjVu that had both foreground and background, with a standard background subsample of 3 and then one of 6. DjVumake still said in both cases that it could not find a background subsample number.

3) Use ddjvu and csepdjvu. (Done correctly?) where fg.djvu is page 1 and where bg.djvu is a DjVu photo.

Create a foreground sepfile using
    ddjvu -format=rle -mode=foreground fg.djvu rledata  (OK)

Create a background sepfile using
    ddjvu -format=ppm -mode=background bg.djvu ppmdata  (OK)

Try to merge foreground and background sepfiles (correct method?)
    csepdjvu rledata ppmdata new5.djvu

Result: csepdjvu says that there is a corrupted input file with a bad header. (cpp:689)

This was so even when the ppm was made from exporting a djvu page as a ppm from DjView4 Win7. The same error message was seen in DjVuLibre Win7 and in DjVuLibre Linux. Adding the .rle and .ppm extensions to the two input files resulted in the same message. It was hard to find examples of using csepdjvu on the internet.

Again, it would be nice to simply batch convert various DjVu photos to photos with clean frames,
like the text pages, and with little change in file size.

I think the clean frames add to the look of the document.

Any suggestions are appreciated.
Thanks for your time.
Stephen Jones
Toronto

1 Attachments

Related

Bugs: #264

Discussion

  • Leon Bottou

    Leon Bottou - 2015-12-30

    First, this is not a bug.

    Second, I believe that your csepdjvu command is incorrect. You should first concatenate rledata and ppmdata into a single file and pass that as argument.
    When csepdjvu takes several input files, it is assumed that each file contains complete pages, not fractions of pages.

    • L.

    From: Stephen Jones stephen16@users.sf.net
    Reply-To: Ticket 264 264@bugs.djvu.p.re.sf.net
    Date: Wednesday, December 30, 2015 at 10:19 AM
    To: Ticket 264 264@bugs.djvu.p.re.sf.net
    Subject: [djvu:bugs] #264 Frames around DjVuPhotos not as clean as with Bitonals

    [bugs:#264] Frames around DjVuPhotos not as clean as with Bitonals

    Status: open
    Group: djview
    Labels: frames batch conversion
    Created: Wed Dec 30, 2015 03:19 PM UTC by Stephen Jones
    Last Updated: Wed Dec 30, 2015 03:19 PM UTC
    Owner: Leon Bottou
    Attachments:
    Attachment_with_frames_8_pages.djvu (882.8 kB; image/vnd.djvu)
    Hi Leon, and Holiday Greetings,

    Recently I have been creating modified photos in GIMP that have a frame with black rounded corners
    and black borders (the rounded rectangle option and the border option). These images look fine when
    converted to ppms, pngs, tiffs, or pdfs. I then have tried to create corresponding DjVu photos with c44 in DjVuLibre and in MiniDjVuPlus.

    One gets artifacts of extra "ghost" lines and smudges along the frame as seen when zooming.
    Using different dpi's and other options do not seem to help. But when I create such a frame as a 1-bit tiff
    and add it as a background watermark to a text-based pdf (PDFill Tools) and then submit the pdf to Any2DjVu, or, if I use DjVu Bitonal in DjVuLibre with other source-image formats, the results are fine.

    DjVuBitonal is fine with it; but DjVuPhoto is not.

    The included attachment has the desired bitonal look of the frame on page 1. The frame is in the foreground layer. Subsequent pages show the way I may wish to present information as a framed text page and then as a photo page that needs the same clean frame. It would be nice if the photo pages had the same clean look to their frames as the text pages' frames have. But I cannot seem to get this to occur.

    Note that the text pages are 600dpi and the photos are 200dpi, properly scaled.
    They look orderly in a side-by-side view.

    Ideally, it would be nice to simply place, in a batch conversion, a clean DjVu foreground frame into a collection of same-sized Djvu photos.

    Three different workarounds were tried, in attempting to segment things. (informed guesswork...)

    1) Use gsdjvu and --threshold=100 to make a good-looking framed-photo pdf look fine as a DjVu framed photo. The frame would not go into the foreground.

    2) Use djvuextract and djvumake to merge the frame JB2 chunk (page 1) Sjbz and a photo background chunk BG44. DjVumake said that it could not find the (c44-based) background chunk subsample number. So I twice used gsdjvu to make a DjVu that had both foreground and background, with a standard background subsample of 3 and then one of 6. DjVumake still said in both cases that it could not find a background subsample number.

    3) Use ddjvu and csepdjvu. (Done correctly?) where fg.djvu is page 1 and where bg.djvu is a DjVu photo.

    Create a foreground sepfile using
    ddjvu -format=rle -mode=foreground fg.djvu rledata (OK)

    Create a background sepfile using
    ddjvu -format=ppm -mode=background bg.djvu ppmdata (OK)

    Try to merge foreground and background sepfiles (correct method?)
    csepdjvu rledata ppmdata new5.djvu

    Result: csepdjvu says that there is a corrupted input file with a bad header. (cpp:689)
    This was so even when the ppm was made from exporting a djvu page as a ppm from DjView4 Win7. The same error message was seen in DjVuLibre Win7 and in DjVuLibre Linux. Adding the .rle and .ppm extensions to the two input files resulted in the same message. It was hard to find examples of using csepdjvu on the internet.

    Again, it would be nice to simply batch convert various DjVu photos to photos with clean frames,
    like the text pages, and with little change in file size.

    I think the clean frames add to the look of the document.

    Any suggestions are appreciated.
    Thanks for your time.
    Stephen Jones
    Toronto

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

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

     

    Related

    Bugs: #264

    • Stephen Jones

      Stephen Jones - 2015-12-30

      Thanks for your advice and fast response.

      Stephen

       
  • Leon Bottou

    Leon Bottou - 2015-12-30
    • labels: frames batch conversion --> frames batch conversion, not-a-bug
    • status: open --> closed
     

Log in to post a comment.

MongoDB Logo MongoDB