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

Go Back   MobileRead Forums > E-Book Formats > Other formats > LRF

Notices

Closed Thread
 
Thread Tools Search this Thread
Old 08-22-2007, 12: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: 77
Karma: 1393
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 05:17 PM.
cacapee is offline  
Old 08-22-2007, 05:36 PM   #2
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 73,661
Karma: 127838198
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Nice job. Looks good in Connect on my computer. Now to download to the reader for a look.
JSWolf is offline  
Old 08-23-2007, 08:35 PM   #3
thinredline
Connoisseur
thinredline doesn't litterthinredline doesn't litter
 
Posts: 59
Karma: 165
Join Date: Aug 2007
Device: Kindle Keyboard, Pocket Edge, Nookd Simple Touch Glowlight, NGP
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  
Old 08-23-2007, 09:24 PM   #4
thinredline
Connoisseur
thinredline doesn't litterthinredline doesn't litter
 
Posts: 59
Karma: 165
Join Date: Aug 2007
Device: Kindle Keyboard, Pocket Edge, Nookd Simple Touch Glowlight, NGP
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  
Old 08-24-2007, 12:24 AM   #5
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 73,661
Karma: 127838198
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
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!
JSWolf is offline  
Old 08-24-2007, 01: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: 77
Karma: 1393
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  
Old 08-24-2007, 09:24 AM   #7
thinredline
Connoisseur
thinredline doesn't litterthinredline doesn't litter
 
Posts: 59
Karma: 165
Join Date: Aug 2007
Device: Kindle Keyboard, Pocket Edge, Nookd Simple Touch Glowlight, NGP
I know it's a bit difficult, but can you write a GUI to make it easier to process files? TIA.
thinredline is offline  
Old 08-24-2007, 02: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  
Old 08-24-2007, 02:40 PM   #9
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 73,661
Karma: 127838198
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
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!
JSWolf is offline  
Old 08-24-2007, 03:44 PM   #10
thinredline
Connoisseur
thinredline doesn't litterthinredline doesn't litter
 
Posts: 59
Karma: 165
Join Date: Aug 2007
Device: Kindle Keyboard, Pocket Edge, Nookd Simple Touch Glowlight, NGP
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  
Old 08-24-2007, 03:56 PM   #11
Nate the great
Sir Penguin of Edinburgh
Nate the great ought to be getting tired of karma fortunes by now.Nate the great ought to be getting tired of karma fortunes by now.Nate the great ought to be getting tired of karma fortunes by now.Nate the great ought to be getting tired of karma fortunes by now.Nate the great ought to be getting tired of karma fortunes by now.Nate the great ought to be getting tired of karma fortunes by now.Nate the great ought to be getting tired of karma fortunes by now.Nate the great ought to be getting tired of karma fortunes by now.Nate the great ought to be getting tired of karma fortunes by now.Nate the great ought to be getting tired of karma fortunes by now.Nate the great ought to be getting tired of karma fortunes by now.
 
Nate the great's Avatar
 
Posts: 12,375
Karma: 23555235
Join Date: Apr 2007
Location: DC Metro area
Device: Shake a stick plus 1
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  
Old 08-24-2007, 04: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: 271
Karma: 332
Join Date: Nov 2003
Location: San Francisco, USA
Device: Sage, Elipsa, Oasis, Galaxy Tab 8U, S22U
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  
Old 08-24-2007, 04:46 PM   #13
Nate the great
Sir Penguin of Edinburgh
Nate the great ought to be getting tired of karma fortunes by now.Nate the great ought to be getting tired of karma fortunes by now.Nate the great ought to be getting tired of karma fortunes by now.Nate the great ought to be getting tired of karma fortunes by now.Nate the great ought to be getting tired of karma fortunes by now.Nate the great ought to be getting tired of karma fortunes by now.Nate the great ought to be getting tired of karma fortunes by now.Nate the great ought to be getting tired of karma fortunes by now.Nate the great ought to be getting tired of karma fortunes by now.Nate the great ought to be getting tired of karma fortunes by now.Nate the great ought to be getting tired of karma fortunes by now.
 
Nate the great's Avatar
 
Posts: 12,375
Karma: 23555235
Join Date: Apr 2007
Location: DC Metro area
Device: Shake a stick plus 1
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  
Old 08-24-2007, 11:30 PM   #14
Nate the great
Sir Penguin of Edinburgh
Nate the great ought to be getting tired of karma fortunes by now.Nate the great ought to be getting tired of karma fortunes by now.Nate the great ought to be getting tired of karma fortunes by now.Nate the great ought to be getting tired of karma fortunes by now.Nate the great ought to be getting tired of karma fortunes by now.Nate the great ought to be getting tired of karma fortunes by now.Nate the great ought to be getting tired of karma fortunes by now.Nate the great ought to be getting tired of karma fortunes by now.Nate the great ought to be getting tired of karma fortunes by now.Nate the great ought to be getting tired of karma fortunes by now.Nate the great ought to be getting tired of karma fortunes by now.
 
Nate the great's Avatar
 
Posts: 12,375
Karma: 23555235
Join Date: Apr 2007
Location: DC Metro area
Device: Shake a stick plus 1
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, 3506 views)

Last edited by Nate the great; 08-24-2007 at 11:34 PM.
Nate the great is offline  
Old 08-25-2007, 04:59 AM   #15
Fallen angel
Time Vortex Manipulator
Fallen angel began at the beginning.
 
Fallen angel's Avatar
 
Posts: 30
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 ...

Last edited by Fallen angel; 08-25-2007 at 05:31 AM.
Fallen angel is offline  
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
soPdf - Better than Yet another PDF to LRF converter theguru PDF 197 11-20-2012 04:54 PM
comiclrf - Comics(CBZ) to LRF converter FangornUK LRF 274 06-16-2010 02:24 PM
Book Processor - Anything to LRF and HTML converter LittleDragon Sony Reader 11 05-13-2008 04:31 PM
Quick/easy LIT to LRF converter? OUTATIME Sony Reader Dev Corner 10 02-29-2008 09:44 AM
Anyone else want chm to lrf converter? buster Sony Reader 10 02-09-2008 05:07 PM


All times are GMT -4. The time now is 11:52 AM.


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