Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Readers > Sony Reader > Sony Reader Dev Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 04-19-2008, 08:11 PM   #1
daqi
Junior Member
daqi began at the beginning.
 
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?
daqi is offline   Reply With Quote
Old 04-19-2008, 11:40 PM   #2
nrapallo
GuteBook/Mobi2IMP Creator
nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.
 
nrapallo's Avatar
 
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:
Originally Posted by daqi View Post
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?
The python source code for PDFRead 1.8.2 is located here. The main thread for PDFRead 1.8 can be found starting here.

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)
Another more simplistic method (not used in PDFRead) would be a simple blur of the image (perhaps at a higher dpi) as follows:
Code:
""" perform image blur """
def dilate_blur(image):
  p('DILATE_BLUR ')
  return image.filter(ImageFilter.BLUR)
Perhaps these will help.
nrapallo is offline   Reply With Quote
Old 04-21-2008, 10:25 AM   #3
daqi
Junior Member
daqi began at the beginning.
 
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.
daqi is offline   Reply With Quote
Old 04-21-2008, 11:17 AM   #4
nrapallo
GuteBook/Mobi2IMP Creator
nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.
 
nrapallo's Avatar
 
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:
Originally Posted by daqi View Post
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.
If the resulting image is too bold, then your source image is at a very low dpi. Can you create a larger picture, then reduce it "at the end" to fit the ereader's display size?

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.
nrapallo is offline   Reply With Quote
Old 04-22-2008, 11:15 AM   #5
daqi
Junior Member
daqi began at the beginning.
 
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.

daqi is offline   Reply With Quote
Old 04-22-2008, 11:28 AM   #6
nrapallo
GuteBook/Mobi2IMP Creator
nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.
 
nrapallo's Avatar
 
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.
Attached Thumbnails
Click image for larger version

Name:	0-new.gif
Views:	533
Size:	70.6 KB
ID:	12326  
nrapallo is offline   Reply With Quote
Reply


Forum Jump

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


All times are GMT -4. The time now is 10:50 PM.


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