01-13-2011, 06:50 PM | #1 |
Connoisseur
Posts: 59
Karma: 10
Join Date: Jan 2011
Device: Kindle 1st Gen, Kindle 3 SO
|
Help with Recipe - Image Sizes
After my unexpected success with the newspaper recipes (my degree is in English, not programming!) I decided to try making a recipe that grabs my favorite webcomic, Girl Genius. I managed to get the thing working ok, but the image size is strange. Basically, it's too small to be readable. Anyone know why the size of the image is being reduced? On the original page, it's width is 700 pixels.
Here's the code. Code:
class GirlGeniusWebcomicRecipe(BasicNewsRecipe): title = u'___Girl Genius @ LJ' description = 'The Adventures of Agatha Heterodyne, Girl Genius.' __author__ = 'Laura Gjovaag' oldest_article = 10 max_articles_per_feed = 5 reverse_article_order = True no_stylesheets = True remove_javascript = True keep_only_tags = [ dict(name='div', attrs={'class':'entry'}), ] remove_tags = [ dict(name='div', attrs={'class':['entrylinks', 'minicomment']}), ] extra_css = 'h1{font: bold 140%;}' feeds = [(u'Girl Genius', u'http://girlgeniuscomic.livejournal.com/data/rss')] Code:
def preprocess_html(self, soup): return self.adeify_images(soup) |
01-13-2011, 08:25 PM | #2 |
creator of calibre
Posts: 44,428
Karma: 24044628
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
depending on what output profile you have chosen, images are automatically scaled down to fit the reader screen. Typical output profiles have a screen size of 600x800
|
Advert | |
|
01-13-2011, 08:57 PM | #3 | |
Connoisseur
Posts: 59
Karma: 10
Join Date: Jan 2011
Device: Kindle 1st Gen, Kindle 3 SO
|
Quote:
Maybe I need to learn Python. |
|
01-13-2011, 09:00 PM | #4 |
creator of calibre
Posts: 44,428
Karma: 24044628
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
if they're much smaller than the screen width than it is not the image scaling. Use the debug pipeline trick to see the images that are downloaded by the recipe and make sure they are the correct size.
|
01-13-2011, 09:08 PM | #5 |
Connoisseur
Posts: 59
Karma: 10
Join Date: Jan 2011
Device: Kindle 1st Gen, Kindle 3 SO
|
Ok, I'll go figure out how to put in the debug pipeline. If it's documented somewhere, I'll find it. Thanks, Kovid!
|
Advert | |
|
01-13-2011, 09:11 PM | #6 |
creator of calibre
Posts: 44,428
Karma: 24044628
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
I suspect you are expecting the recipe to download the image from the rss feed, but it is following the link in the feed to a webpage from which it is getting a thumbnail
|
01-13-2011, 09:47 PM | #7 |
Connoisseur
Posts: 59
Karma: 10
Join Date: Jan 2011
Device: Kindle 1st Gen, Kindle 3 SO
|
Ok... I've been playing with this for awhile. It seems like the size of the image that is downloaded is correct. I think. When I go to the viewer, the size is smaller.
So I tried to figure out how big from the viewer, and got to a "Web Inspector" window that gave me this: Code:
<img height="1061" width="700" src="images/00008.jpg" class="calibre_40" style="height: 593px; width: 391.235px; "> Last edited by Tegan; 01-13-2011 at 10:16 PM. |
01-14-2011, 10:46 AM | #8 |
creator of calibre
Posts: 44,428
Karma: 24044628
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
593px is what is needed to fit inside a screen that is 600px wide, like the Kindle screen.
|
01-14-2011, 11:07 AM | #9 |
Connoisseur
Posts: 59
Karma: 10
Join Date: Jan 2011
Device: Kindle 1st Gen, Kindle 3 SO
|
|
01-14-2011, 11:34 AM | #10 |
creator of calibre
Posts: 44,428
Karma: 24044628
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Are you sure you have an output profile of Kindle and you are generating a MOBI file? Because I tried your recipe and this is what I get
|
01-14-2011, 03:52 PM | #11 | |
Connoisseur
Posts: 59
Karma: 10
Join Date: Jan 2011
Device: Kindle 1st Gen, Kindle 3 SO
|
Quote:
Again, thanks! |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Kindle Automatically Doubles Image Sizes | wallcraft | Amazon Kindle | 5 | 04-01-2011 11:59 AM |
Image Sizes (hxw) for iPad? Anyone know? | Hitch | Sigil | 0 | 07-25-2010 06:47 PM |
Image sizes in Kindle | chrisborg | Amazon Kindle | 2 | 05-17-2010 01:49 AM |
Image Sizes | PieOPah | Workshop | 0 | 02-09-2009 11:26 AM |
Mobipocket Cover Image Sizes | pdurrant | Bookeen | 3 | 09-15-2008 08:24 PM |