MobileRead Forums
Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Formats > LRF

Welcome to the MobileRead Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community today, you will have fewer ads, access to post topics, communicate privately with other members, respond to polls, upload content and access many other special features.

If you have any problems with the registration process or your account login, please contact us.

Hint: Don't have time to visit us daily? Subscribe to our main RSS feed to receive our frontpage posts at your convenience.

Notices

LRF Sony LRF (or BBeB) is a proprietary format supported by all Sony Reader devices

Reply
 
Thread Tools Search this Thread Display Modes
Old 08-22-2007, 01:54 PM   #1
cacapee
Connoisseur
cacapee is no ebook tyro.cacapee is no ebook tyro.cacapee is no ebook tyro.cacapee is no ebook tyro.cacapee is no ebook tyro.cacapee is no ebook tyro.cacapee is no ebook tyro.cacapee is no ebook tyro.cacapee is no ebook tyro.cacapee is no ebook tyro.
 
Posts: 66
Karma: 1391
Join Date: Aug 2007
Location: Santa Monica
Device: prs-500
Yet another PDF to LRF converter

Moderator's Note: I've taken down the attached programs because it appears to be in violation of GPL. They will go back up after the issue is resolved.

Nate the great



Hi, I've taken some of the ideas of existing tools along with a few refinements of my own to code this one up. I've attached a few sample conversions to get an idea of what the tool can do.

The refinements are --runpages (which causes adjacent pdf pages to be spliced into the same image if possible) and --smartcut (which avoids the annoying splits at the edge of the image) Another feature is that landscape mode (which is the default) rotates the image but doesn't actually use the Reader's landscape mode.

f_l.lrf outputs the page that can be viewed by rotating the reader (-rs)
f_p.lrf outputs the page in portrait mode (-prs)
f_po.lrf outputs the page without runpages and smartcut (-p)
g_2col.lrf sample of two column mode (-vrs)
comicl.pdf comicp.pdf strips in landscape and portrait mode (uses --nosplitpage -rs)

The pdf files tested are linked here

http://cm.bell-labs.com/cm/ms/what/s...hannon1948.pdf
http://www.comp.nus.edu.sg/~tants/tsm/tsm.pdf

Code:
pdflrf 0.99

A program to generate lrf files for the Sony Reader
Needs Ghostscript to be installed unless you are using poppler

Usage: For 2 column portrait mode
        pdflrf.exe -vrs -i file.pdf -o file.lrf
   For landscape mode
        pdflrf.exe --rotation=-90 -rs -i file.djvu -o file.lrf
   For comics
        pdflrf.exe -nrs --erode 1 -i file.cbz -o file.lrf


  -h, --help                  Print help and exit
  -V, --version               Print version and exit
  -i, --input=STRING          Input file (PDF, DJVU, CBZ)
  -o, --output=STRING         Output file
  -f, --firstpage=INT         First page to process  (default=`1')
  -l, --lastpage=INT          Last page to process  (default=`-1')
      --ghostscript           Use ghostscript (instead of poppler by default)
                                to read pdf files  (default=off)

LRF file metadata
  -t, --title=STRING          Title
  -a, --author=STRING         Author
      --category=STRING       Category
      --publisher=STRING      Publisher

LRF file generation properties
      --fit=STRING            Scale image  (possible values="width",
                                "height", "2xheight" default=`width')
      --rotation=STRING       Rotation  (possible values="-90", "0",
                                "90", "180" default=`-90')
      --filter=STRING         Resizing filter  (possible values="lanczos",
                                "quadratic", "cubic", "catrom",
                                "mitchell", "sinc", "bessel"
                                default=`lanczos')
      --stretch               Stretch image to fit screen  (default=off)
  -v, --vsplit                Vertically split the page  (default=off)
  -r, --runpages              Run pages together  (default=off)
      --pad=INT               Pad (in pixels) to add when concatenating pages
                                (default=`3')
  -s, --smartcut              Cut pages at blank lines  (default=off)
  -n, --nosplitpage           Do not split pages across images  (default=off)
      --notoc                 Do not add TOC  (default=off)

Image processing
      --erode=INT             Size of erosion kernel (2 works well too)
                                (default=`3')
      --overlap=FLOAT         Overlap % between successive pages
                                (default=`0.05')
  -c, --colors=INT            Number of colors in final image  (default=`4')
      --grayscale             Convert image to grayscale  (default=on)
      --nocrop                Do not crop the sides automatically
                                (default=off)
      --outputimages          Write generated images out  (default=off)
      --width=INT             Width of final image  (default=`584')
      --height=INT            Height of final image  (default=`754')

The following options are run before any of the above processing is done
      --trimleft=FLOAT        Trim width*trimleft/100 pixels from the left for
                                all pages  (default=`0')
      --trimright=FLOAT       Trim width*trimright/100 pixels from the right
                                for all pages  (default=`0')
      --trimtop=FLOAT         Trim height*trimtop/100 pixels from the top for
                                all pages  (default=`0')
      --trimbottom=FLOAT      Trim height*trimbottom/100 pixels from the bottom
                                for all pages  (default=`0')
      --eventrimleft=FLOAT    Trim width*trimleft/100 pixels from the left for
                                even pages  (default=`0')
      --eventrimright=FLOAT   Trim width*trimright/100 pixels from the right
                                for even pages  (default=`0')
      --eventrimtop=FLOAT     Trim height*trimtop/100 pixels from the top for
                                even pages  (default=`0')
      --eventrimbottom=FLOAT  Trim height*trimbottom/100 pixels from the bottom
                                for even pages  (default=`0')
      --oddtrimleft=FLOAT     Trim width*trimleft/100 pixels from the left for
                                odd pages  (default=`0')
      --oddtrimright=FLOAT    Trim width*trimright/100 pixels from the right
                                for odd pages  (default=`0')
      --oddtrimtop=FLOAT      Trim height*trimtop/100 pixels from the top for
                                odd pages  (default=`0')
      --oddtrimbottom=FLOAT   Trim height*trimbottom/100 pixels from the bottom
                                for odd pages  (default=`0')
      --fuzz=FLOAT            Fuzz factor % for matching colors
                                (default=`0.01')
version 0.2 now reads in cbz and djvu files. It also reads pdf files using poppler - so you do not need to install ghostscript.

version 0.3 has a windows gui. --portrait has been removed and replaced by --rotation. Default is portrait now. Also metadata from pdf files are automatically read

version 0.4 adds drag/drop and batch processing (drag mutiple files over) + other small refinements (not specifying smartcut/runpages/splitpage scales a page to fit in an image)

version 0.5 has support for pre-trimming off the input pages. These are specifed in terms of % of the page from the left/right/top/bottom that you want to trim away. They can also be specified independently for even/odd pages. Also unicode metadata is now supported.

version 0.6 adds support for unicode filenames (previously only unicode metadata was supported), cbr/rar files, better error reporting and assorted bug fixes.

version 0.7 adds preview of pre trimming, catrom filter for resizing images, png files are now generated for embedding in lrf files. Converted over to using threads - so batching is a lot more improved.

version 0.8 adds support for Table of Contents in pdf files. It is possible to preview output images to test out various settings. An experimental linux build (built on Ubuntu) has been added. Improved threading support so processing should be faster. Changed default colors to 4 to reduce frequency of file size questions. Added more filtering options and better dithering so images should look a lot better.
Fixed threading bug that causes it to hang occasionally under linux. Fixed TOC. Erosion now works sensibly with small images (like those of comic strips). Can also go down to 2 colors.

version 0.9 Added padding (in pixels) when using runpages. Fixed crash bug when generating toc. Added back ghostscript support. Added option to disable generation of TOC.

version 0.99 Fixed Librie compatibility (maybe). Adjustable image size on output. Output zip files (if extension is cbz or zip). Added RGB output. Added post stretch of image to fit page. Added options to fit image by height/width/2*height etc. Sort files in rar and zip.

Fixed bug in dos and linux commandline versions that ignored toc. Fixed metadata bug.

I've broken out the dos commandline, windows gui and linux commandline versions into separate files to better track usage.
Attachments Pending Approval
File Type: lrf f_l.lrf
File Type: lrf f_p.lrf
File Type: lrf g_2col.lrf
File Type: lrf comicp.lrf
File Type: zip pdflrfwin-0.9.zip
File Type: zip pdflrfdos-0.9.zip
File Type: gz pdflrflinux-0.9.gz
File Type: zip pdflrfwin-0.99.zip
File Type: gz pdflrflinux-0.99.gz
File Type: zip pdflrfdos-0.99.zip

Last edited by cacapee; 09-30-2007 at 06:17 PM.
cacapee is offline   Reply With Quote
Old 08-22-2007, 06:36 PM   #2
JSWolf
Mobile Reader Geek
JSWolf has a certain pleonastic somethingJSWolf has a certain pleonastic somethingJSWolf has a certain pleonastic somethingJSWolf has a certain pleonastic somethingJSWolf has a certain pleonastic somethingJSWolf has a certain pleonastic somethingJSWolf has a certain pleonastic somethingJSWolf has a certain pleonastic somethingJSWolf has a certain pleonastic somethingJSWolf has a certain pleonastic somethingJSWolf has a certain pleonastic something
 
JSWolf's Avatar
 
Posts: 16,132
Karma: 18503
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Sony Reader PRS-505
Nice job. Looks good in Connect on my computer. Now to download to the reader for a look.
__________________
Jon



If you want to listen to really good music while you surf Mobileread, here.
JSWolf is offline   Reply With Quote
Old 08-23-2007, 09:35 PM   #3
thinredline
Member
thinredline is on a distinguished road
 
Posts: 17
Karma: 65
Join Date: Aug 2007
Device: PRS 500
I am not a programmer. How does this tool work? Is it a windows application? or it can only be used on linux?
thinredline is offline   Reply With Quote
Old 08-23-2007, 10:24 PM   #4
thinredline
Member
thinredline is on a distinguished road
 
Posts: 17
Karma: 65
Join Date: Aug 2007
Device: PRS 500
Load the attached samples to my reader. The result is excellent! Very sharp edge. Can you tell me how to use the tool in detail? TIA.
thinredline is offline   Reply With Quote
Old 08-24-2007, 01:24 AM   #5
JSWolf
Mobile Reader Geek
JSWolf has a certain pleonastic somethingJSWolf has a certain pleonastic somethingJSWolf has a certain pleonastic somethingJSWolf has a certain pleonastic somethingJSWolf has a certain pleonastic somethingJSWolf has a certain pleonastic somethingJSWolf has a certain pleonastic somethingJSWolf has a certain pleonastic somethingJSWolf has a certain pleonastic somethingJSWolf has a certain pleonastic somethingJSWolf has a certain pleonastic something
 
JSWolf's Avatar
 
Posts: 16,132
Karma: 18503
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Sony Reader PRS-505
Quote:
Originally Posted by cacapee View Post
Hi, I've taken some of the ideas of existing tools along with a few refinements of my own to code this one up. I've attached a few sample conversions to get an idea of what the tool can do.
The attached ZIP file is just source code. Would you mind attaching actual compiled code that's ready to run. Also, what operating systems does this run under? Thanks!
__________________
Jon



If you want to listen to really good music while you surf Mobileread, here.
JSWolf is offline   Reply With Quote
Old 08-24-2007, 02:35 AM   #6
cacapee
Connoisseur
cacapee is no ebook tyro.cacapee is no ebook tyro.cacapee is no ebook tyro.cacapee is no ebook tyro.cacapee is no ebook tyro.cacapee is no ebook tyro.cacapee is no ebook tyro.cacapee is no ebook tyro.cacapee is no ebook tyro.cacapee is no ebook tyro.
 
Posts: 66
Karma: 1391
Join Date: Aug 2007
Location: Santa Monica
Device: prs-500
I've attached the executable. It required ghostscript to be installed (I've tested it with the latest version). More improvements - it now reads in djvu files. Also it does auto cropping of the left and right edges. Please try it out and provide feedback.

I purposefully designed it so that it is cross platform. However for now it's windows only.

Thanks!
cacapee is offline   Reply With Quote
Old 08-24-2007, 10:24 AM   #7
thinredline
Member
thinredline is on a distinguished road
 
Posts: 17
Karma: 65
Join Date: Aug 2007
Device: PRS 500
I know it's a bit difficult, but can you write a GUI to make it easier to process files? TIA.
thinredline is offline   Reply With Quote
Old 08-24-2007, 03:31 PM   #8
threetwo
Junior Member
threetwo began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Aug 2007
Device: Sony
...

Your program is awesome!! Thank you for building and sharing it. I have been using the other rasterizers with varying frustration at converting hundreds of math-intensive papers. Your program worked right off the bat, with perfect results. I bought the Sony reader knowing it wasn't going to be perfect for what I wanted, and was willing to live with it ... but now it might actually be better than I expected!
threetwo is offline   Reply With Quote
Old 08-24-2007, 03:40 PM   #9
JSWolf
Mobile Reader Geek
JSWolf has a certain pleonastic somethingJSWolf has a certain pleonastic somethingJSWolf has a certain pleonastic somethingJSWolf has a certain pleonastic somethingJSWolf has a certain pleonastic somethingJSWolf has a certain pleonastic somethingJSWolf has a certain pleonastic somethingJSWolf has a certain pleonastic somethingJSWolf has a certain pleonastic somethingJSWolf has a certain pleonastic somethingJSWolf has a certain pleonastic something
 
JSWolf's Avatar
 
Posts: 16,132
Karma: 18503
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Sony Reader PRS-505
Quote:
Originally Posted by cacapee View Post
I've attached the executable. It required ghostscript to be installed (I've tested it with the latest version). More improvements - it now reads in djvu files. Also it does auto cropping of the left and right edges. Please try it out and provide feedback.

I purposefully designed it so that it is cross platform. However for now it's windows only.

Thanks!
Thank you very much!
__________________
Jon



If you want to listen to really good music while you surf Mobileread, here.
JSWolf is offline   Reply With Quote
Old 08-24-2007, 04:44 PM   #10
thinredline
Member
thinredline is on a distinguished road
 
Posts: 17
Karma: 65
Join Date: Aug 2007
Device: PRS 500
Sometimes I got right side of the content being cut off a bit. How do I adjust the parameters to avoid this? TIA.
thinredline is offline   Reply With Quote
Old 08-24-2007, 04:56 PM   #11
Nate the great
Sir Penguin of Edinburgh
Nate the great can load mercury with a pitchforkNate the great can load mercury with a pitchforkNate the great can load mercury with a pitchforkNate the great can load mercury with a pitchforkNate the great can load mercury with a pitchforkNate the great can load mercury with a pitchforkNate the great can load mercury with a pitchforkNate the great can load mercury with a pitchforkNate the great can load mercury with a pitchforkNate the great can load mercury with a pitchforkNate the great can load mercury with a pitchfork
 
Nate the great's Avatar
 
Posts: 7,285
Karma: 48386
Join Date: Apr 2007
Location: Northern Virginia
Device: Airpanel 100, Jornada 720, Kindle, Smart Q7, Zelda has Sony 600 & 700
I tried it and get the following error:

Can't load DLL, LoadLibrary error code 0



I've looked at your samples, and they make me really really want to get your program working
Nate the great is offline   Reply With Quote
Old 08-24-2007, 05:19 PM   #12
ddavtian
Addict
ddavtian has a complete set of Star Wars action figures.ddavtian has a complete set of Star Wars action figures.ddavtian has a complete set of Star Wars action figures.ddavtian has a complete set of Star Wars action figures.
 
Posts: 222
Karma: 332
Join Date: Nov 2003
Location: San Francisco, USA
Device: Sony Readers 505 & 700, Kindle DX
Quote:
Originally Posted by Nate the great View Post
I tried it and get the following error:

Can't load DLL, LoadLibrary error code 0
After this error I downloaded and installed ghostscript (google it), works fine. Thanks for a good application.

David
ddavtian is offline   Reply With Quote
Old 08-24-2007, 05:46 PM   #13
Nate the great
Sir Penguin of Edinburgh
Nate the great can load mercury with a pitchforkNate the great can load mercury with a pitchforkNate the great can load mercury with a pitchforkNate the great can load mercury with a pitchforkNate the great can load mercury with a pitchforkNate the great can load mercury with a pitchforkNate the great can load mercury with a pitchforkNate the great can load mercury with a pitchforkNate the great can load mercury with a pitchforkNate the great can load mercury with a pitchforkNate the great can load mercury with a pitchfork
 
Nate the great's Avatar
 
Posts: 7,285
Karma: 48386
Join Date: Apr 2007
Location: Northern Virginia
Device: Airpanel 100, Jornada 720, Kindle, Smart Q7, Zelda has Sony 600 & 700
Quote:
Originally Posted by Nate the great View Post
I tried it and get the following error:

Can't load DLL, LoadLibrary error code 0


I've looked at your samples, and they make me really really want to get your program working

It works now. Here is where you can download Ghostscript:


http://sourceforge.net/project/showf...ease_id=529280
Nate the great is offline   Reply With Quote
Old 08-25-2007, 12:30 AM   #14
Nate the great
Sir Penguin of Edinburgh
Nate the great can load mercury with a pitchforkNate the great can load mercury with a pitchforkNate the great can load mercury with a pitchforkNate the great can load mercury with a pitchforkNate the great can load mercury with a pitchforkNate the great can load mercury with a pitchforkNate the great can load mercury with a pitchforkNate the great can load mercury with a pitchforkNate the great can load mercury with a pitchforkNate the great can load mercury with a pitchforkNate the great can load mercury with a pitchfork
 
Nate the great's Avatar
 
Posts: 7,285
Karma: 48386
Join Date: Apr 2007
Location: Northern Virginia
Device: Airpanel 100, Jornada 720, Kindle, Smart Q7, Zelda has Sony 600 & 700
I have a request. A couple of my free PDFs have tiny marks right on the top and bottom edge of the page. This prevents it from being cropped. The one PDF I have done so far is about twice the size it should be. Can you figure out a way to fix it?

This is a really nice tool.




An example should be attached.
Attached Files
File Type: lrf practicalcommonlisp.lrf (1.14 MB, 1178 views)

Last edited by Nate the great; 08-25-2007 at 12:34 AM.
Nate the great is offline   Reply With Quote
Old 08-25-2007, 05:59 AM   #15
Fallen angel
Among the fallen ones
Fallen angel began at the beginning.
 
Fallen angel's Avatar
 
Posts: 25
Karma: 10
Join Date: Aug 2007
Location: Greece
Device: Sony Reader
I'm sorry, but I couldn't understand how is this application working ... could somebody give me some instructions?

The only thing happening when I'm running the pdflrf.exe file, is opening a dos window that closes within a sec ...
__________________
Patriotism is your conviction that this country is superior to all other countries because you were born in it.

Last edited by Fallen angel; 08-25-2007 at 06:31 AM.
Fallen angel is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
LRF output kovidgoyal Calibre 854 10-23-2009 08:53 AM
comiclrf - Comics(CBZ) to LRF converter FangornUK LRF 266 09-20-2009 04:58 PM
Encrypted PDF Converter? NatCh Sony Portable Reader PRS-500/505 11 04-30-2008 11:20 PM
Anyone else want chm to lrf converter? buster Reader Content 10 02-09-2008 06:07 PM
Linux based HTML to LRF converter? Thiana Reader PRS-500 Dev Corner 3 04-08-2007 03:34 AM


All times are GMT -4. The time now is 06:32 PM.


MobileRead.com is a privately owned, operated and funded community.