04-19-2008, 08:11 PM | #1 |
Junior Member
Posts: 5
Karma: 10
Join Date: Apr 2008
Device: PRS-505
|
prflrf source code?
I've been working on a txt2lrf program which
could work with any encoding. The tool would first render the txt file, save the result to a gif image, and then embed all the GIFs to a LRF file. I've studied the makelrf source code, and got everything almost done. But what I found was, the antialiased font doesn't work very well on the Sony Reader - not as good as pdflrf. It seems pdflrf uses an Image Edge Enhancement algorithm to make the text 'bolder'. (I tried Sobel operator, but it didn't work very well.) As I'm not quite familiar with image processing, I wonder if the source of pdflrf is available so that I can refer to it. I've been searching over the internet all day, but couldnt find it. Anybody could help? |
04-19-2008, 11:40 PM | #2 | |
GuteBook/Mobi2IMP Creator
Posts: 2,958
Karma: 2530691
Join Date: Dec 2007
Location: Toronto, Canada
Device: REB1200 EBW1150 Device: T1 NSTG iLiad_v2 NC Device: Asus_TF Next1 WPDN
|
Quote:
The image routines used therein are supported by the Python Imaging Library (PIL). In particular, to thicken the text, I use the following routine, in the module 'process.py': Code:
""" perform image dilation """ def dilate(image): p('DILATE ') return image.filter(ImageFilter.MinFilter) Code:
""" perform image blur """ def dilate_blur(image): p('DILATE_BLUR ') return image.filter(ImageFilter.BLUR) |
|
Advert | |
|
04-21-2008, 10:25 AM | #3 |
Junior Member
Posts: 5
Karma: 10
Join Date: Apr 2008
Device: PRS-505
|
Thanks for your reply. I tried the filters in Python, but doesnt seem to work very well.
ImageFilter.Min makes it far too bold, and some of the strokes would overlap. ImageFilter.BLUR simply doesnt work. It's so blurred that I guess nobody could even figure out what's written. I hope the filter could work out as the way for the Image Edge Enhancement filter in Photoshop CS2. |
04-21-2008, 11:17 AM | #4 | |
GuteBook/Mobi2IMP Creator
Posts: 2,958
Karma: 2530691
Join Date: Dec 2007
Location: Toronto, Canada
Device: REB1200 EBW1150 Device: T1 NSTG iLiad_v2 NC Device: Asus_TF Next1 WPDN
|
Quote:
Also, Image Edge Enhancement is a 'sharpening' method which has the opposite effect of reducing the width of the text, not widening it. What you can try then is make it bold first, then sharpen it afterwards. |
|
04-22-2008, 11:15 AM | #5 |
Junior Member
Posts: 5
Karma: 10
Join Date: Apr 2008
Device: PRS-505
|
As they say, a picture worths 1000 words. I think it's better for me to post the pictures here. The 0.gif is what I've generated, and the test.gif is what I got from Photoshop.
They're with different text contents and in Simplified Chinese. But I think you can see the idea behind it. I don't think bolding the font would work, as Photoshop doesnt need to do so. |
Advert | |
|
04-22-2008, 11:28 AM | #6 |
GuteBook/Mobi2IMP Creator
Posts: 2,958
Karma: 2530691
Join Date: Dec 2007
Location: Toronto, Canada
Device: REB1200 EBW1150 Device: T1 NSTG iLiad_v2 NC Device: Asus_TF Next1 WPDN
|
OK, I took your 0.gif, rescaled it larger by 300%, blurred it and shrunk it back by 33% (I couldn't do 33.33333%) and got the following 0-new.gif.
Is this better than the photoshop one, on your ereader? If it is, then you should perform your image manipulations at a higher dpi (dots per inch), then resize back down to your final size. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Let's create a source code repository for DR 800 related code? | jraf | iRex | 3 | 03-11-2010 12:26 PM |
Source Code Reading | Jamp | Workshop | 3 | 07-16-2009 03:20 PM |
Cannot download 2.0.2 and 2.0.1 source code | rfog | Kindle Developer's Corner | 6 | 05-22-2009 09:34 AM |
Source code available | AlfonsVH | HanLin eBook | 3 | 01-03-2009 02:30 PM |
source code?? | joblack | iRex | 1 | 11-01-2006 12:16 PM |