|
|||||||
|
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. |
| LRF Sony LRF (or BBeB) is a proprietary format supported by all Sony Reader devices |
![]() |
|
|
Thread Tools | Search this Thread | Display Modes |
|
|
#1 |
|
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
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.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. Last edited by cacapee; 09-30-2007 at 06:17 PM. |
|
|
|
|
|
#2 |
|
Mobile Reader Geek
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
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.
|
|
|
|
|
|
#3 |
|
Member
![]()
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?
|
|
|
|
|
|
#4 |
|
Member
![]()
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.
|
|
|
|
|
|
#5 |
|
Mobile Reader Geek
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
Posts: 16,132
Karma: 18503
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Sony Reader PRS-505
|
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!
|
|
|
|
|
|
#6 |
|
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
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! |
|
|
|
|
|
#7 |
|
Member
![]()
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.
|
|
|
|
|
|
#8 |
|
Junior Member
![]()
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!
|
|
|
|
|
|
#9 | |
|
Mobile Reader Geek
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
Posts: 16,132
Karma: 18503
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Sony Reader PRS-505
|
Quote:
|
|
|
|
|
|
|
#10 |
|
Member
![]()
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.
|
|
|
|
|
|
#11 |
|
Sir Penguin of Edinburgh
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
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 |
|
|
|
|
|
#12 |
|
Addict
![]() ![]() ![]() ![]()
Posts: 222
Karma: 332
Join Date: Nov 2003
Location: San Francisco, USA
Device: Sony Readers 505 & 700, Kindle DX
|
|
|
|
|
|
|
#13 | |
|
Sir Penguin of Edinburgh
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
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:
It works now. Here is where you can download Ghostscript: http://sourceforge.net/project/showf...ease_id=529280 |
|
|
|
|
|
|
#14 |
|
Sir Penguin of Edinburgh
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
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. Last edited by Nate the great; 08-25-2007 at 12:34 AM. |
|
|
|
|
|
#15 |
|
Among the fallen ones
![]()
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. |
|
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
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 |