View Single Post
Old 11-21-2011, 09:56 PM   #18
nickredding
onlinenewsreader.net
nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'
 
Posts: 320
Karma: 10143
Join Date: Dec 2009
Location: Phoenix, AZ & Victoria, BC
Device: Kindle 3, Kindle Fire, IPad3, iPhone4, Playbook, HTC Inspire
Masthead logos and cover pages images for Kindle Fire

Kindle Fire treats masthead logos differently than its e-ink cousins, and they end up not looking as good as on e-ink readers. The Fire automatically scales the logos and color-inverts them (so black becomes white, red become turquoise, etc.). The logo is displayed an an almost-black background (it's actually a slight gradiant).

The Fire also displays the publication front page on the Newsstand bookshelf, so this encouraged me to go looking for a source of these front page images instead of looking at the default calibre image.

The following code fragments can be inserted into your custom recipe to invoke a custom masthead logo and a front page image (if it's available).
Spoiler:
Code:
    def get_cover_url(self):
        # If your newspaper is represented at http://www.newseum.org/todaysfrontpages/default.asp
        # mouse over its front page image and look for fpVname=<tag> in the URL, and replace NY_NYT
        # with the <tag>. For example, for the New York Times the URL looks like
        #    http://www.newseum.org/todaysfrontpages/hr.asp?fpVname=NY_NYT&ref_pge=gal&b_pge=1
        # so the <tag> is NY_NYT
        from datetime import date
        # Note: this tag is for the New York Times, You must replace NY_NYT with your <tag>
        tag = 'NY_NYT'
        cover = 'http://webmedia.newseum.org/newseum-multimedia/dfp/jpg'+str(date.today().day)+'/lg/'+tag+'.jpg'
        br = BasicNewsRecipe.get_browser()
        try:
            br.open(cover)
        except:
            self.log("\nCover unavailable")
            cover = None
        return cover

    # Provide the path to your custom masthead logo here. This path is for my New York Times logo.
    # Your logo should have a height/width ratio as close to 1/10 as possible.
    # Kindle Fire color-inverts the logo and scales it automatically to fit in a box approximately
    # 25 x 250 pixels. For best results your logo should have a background of R/G/B 211/211/211
    # since this will appear transparent. If you are really picky you can make your backgound a
    # linear gradiant of 211/211/211 at the top to 214/214/214 at the bottom.
    masthead_url="C:\\Users\\Nick\\nytlogo.jpg"
    def prepare_masthead_image(self, path_to_image, out_path):
        from calibre import fit_image
        from calibre.utils.magick import Image, create_canvas
        img = Image()
        img.open(path_to_image)
        img.open(path_to_image)
        width, height = img.size
        img2 = create_canvas(width, height)
        img2.compose(img)
        img2.save(out_path)

Note that when you develop a masthead logo, plan for it to be color-inverted (so if you want the original color, provide the color-inverted version as the logo). The background should be R/G/B 211/211/211 and (after being inverted) it will blend with the Fire background to appear transparent. If you are really picky you can make the background pretty well perfect by using a linear gradiant (top to bottom) of 211/211/211 to 214/214/214. The size of the logo isn't all that important since the Fire will scale it, but logos at least 250 pixels wide will look better than smaller ones since upscaling doesn't work as well as reduction.

I have atached 4 Fire-friendly logos in a ZIP file (NY Times, Wall Street Journal, Globe and Mail, National Post).
Attached Files
File Type: zip logos.zip (91.0 KB, 132 views)

Last edited by Starson17; 11-22-2011 at 09:42 AM.
nickredding is offline   Reply With Quote