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

Go Back   MobileRead Forums > E-Book Software > Calibre > Recipes

Notices

Reply
 
Thread Tools Search this Thread
Old 01-13-2011, 06:50 PM   #1
Tegan
Connoisseur
Tegan began at the beginning.
 
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')]
I tried messing around with image_url_processor, but I couldn't figure it out. I just don't know enough python, I guess. I also tried adding
Code:
def preprocess_html(self, soup):
        return self.adeify_images(soup)
but it didn't help. Any ideas?
Tegan is offline   Reply With Quote
Old 01-13-2011, 08:25 PM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 25,993
Karma: 5036765
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
kovidgoyal is online now   Reply With Quote
 
Enthusiast
Old 01-13-2011, 08:57 PM   #3
Tegan
Connoisseur
Tegan began at the beginning.
 
Posts: 59
Karma: 10
Join Date: Jan 2011
Device: Kindle 1st Gen, Kindle 3 SO
Quote:
Originally Posted by kovidgoyal View Post
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
I'm outputting to mobi, for the Kindle. I also tried outputting to ePub in case that was causing the problem. But the size of the images is MUCH smaller than 600x800. Is there a way to turn off the automatic image scaling so I can see if the problem is on the Calibre side, or something to do with the website?

Maybe I need to learn Python.
Tegan is offline   Reply With Quote
Old 01-13-2011, 09:00 PM   #4
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 25,993
Karma: 5036765
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.
kovidgoyal is online now   Reply With Quote
Old 01-13-2011, 09:08 PM   #5
Tegan
Connoisseur
Tegan began at the beginning.
 
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!
Tegan is offline   Reply With Quote
Old 01-13-2011, 09:11 PM   #6
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 25,993
Karma: 5036765
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
kovidgoyal is online now   Reply With Quote
Old 01-13-2011, 09:47 PM   #7
Tegan
Connoisseur
Tegan began at the beginning.
 
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; ">
Where is that style attribute coming from? And more importantly, can I override it somehow?

Last edited by Tegan; 01-13-2011 at 10:16 PM.
Tegan is offline   Reply With Quote
Old 01-14-2011, 10:46 AM   #8
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 25,993
Karma: 5036765
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.
kovidgoyal is online now   Reply With Quote
Old 01-14-2011, 11:07 AM   #9
Tegan
Connoisseur
Tegan began at the beginning.
 
Posts: 59
Karma: 10
Join Date: Jan 2011
Device: Kindle 1st Gen, Kindle 3 SO
Quote:
Originally Posted by kovidgoyal View Post
593px is what is needed to fit inside a screen that is 600px wide, like the Kindle screen.
Except 593 is the height, not the width. If it were the width, that would be fine.
Tegan is offline   Reply With Quote
Old 01-14-2011, 11:34 AM   #10
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 25,993
Karma: 5036765
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
Attached Files
File Type: mobi t.mobi (1.03 MB, 70 views)
kovidgoyal is online now   Reply With Quote
Old 01-14-2011, 03:52 PM   #11
Tegan
Connoisseur
Tegan began at the beginning.
 
Posts: 59
Karma: 10
Join Date: Jan 2011
Device: Kindle 1st Gen, Kindle 3 SO
Quote:
Originally Posted by kovidgoyal View Post
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
Thanks for the assistance! I think I'm going to chalk this one up to end-user error for now, and go play with the other recipes. I think I need more knowledge about how the recipes work. Maybe I should go study Python.

Again, thanks!
Tegan is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

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


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


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