Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 06-15-2023, 12:45 PM   #1
xav
Member
xav began at the beginning.
 
Posts: 22
Karma: 10
Join Date: Mar 2014
Device: Kindle paperwhite 2
The Economist - images compressed ?

Hello,

I want to get a smaller version of the Economist with more compressed, low quality images.

Starting from:
- the original recipe: https://github.com/kovidgoyal/calibr...onomist.recipe

- And the Calibre documentation: https://manual.calibre-ebook.com/news_recipe.html

I tried to change the following parameters in the recipe (line 195 and following):
self.web2disk_options.compress_news_images = True
self.web2disk_options.compress_news_images_auto_si ze = 2
self.web2disk_options.compress_news_images_max_siz e = 5

...But I don't get a smaller Epub as a result (still ~25 Mo) ?
Could anyone please help ? Thanks !
xav is offline   Reply With Quote
Old 06-15-2023, 11:23 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: 44,006
Karma: 22669822
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You set options as fields directly in your BasicNewsRecipe subclass.
kovidgoyal is offline   Reply With Quote
Old 06-22-2023, 03:14 PM   #3
xav
Member
xav began at the beginning.
 
Posts: 22
Karma: 10
Join Date: Mar 2014
Device: Kindle paperwhite 2
I tried to add the options under the existing lines from line 195, as follows, but it did not work (I'm not a developer so I only have some basics about coding and I'm a bit lost in the recipe's classes):

def __init__(self, *args, **kwargs):
BasicNewsRecipe.__init__(self, *args, **kwargs)
if self.output_profile.short_name.startswith('kindle' ):
# Reduce image sizes to get file size below amazon's email
# sending threshold
self.web2disk_options.compress_news_images = True
# Code modifié Xav: 2 au lieu de 5
self.web2disk_options.compress_news_images_auto_si ze = 2
# Code modifié Xav ajout de la ligne ci-dessous pour que les images ne dépassent pas 50kb
self.web2disk_options.compress_news_images_max_siz e = 50
self.log.warn('Kindle Output profile being used, reducing image quality to keep file size below amazon email threshold')
xav is offline   Reply With Quote
Old 06-22-2023, 09:51 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: 44,006
Karma: 22669822
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Look at the BasicNewsRecipe class docs, that will tell you the names of the options https://manual.calibre-ebook.com/new...ss_news_images
kovidgoyal is offline   Reply With Quote
Old 06-23-2023, 05:09 AM   #5
Dsharma
Enthusiast
Dsharma ought to be getting tired of karma fortunes by now.Dsharma ought to be getting tired of karma fortunes by now.Dsharma ought to be getting tired of karma fortunes by now.Dsharma ought to be getting tired of karma fortunes by now.Dsharma ought to be getting tired of karma fortunes by now.Dsharma ought to be getting tired of karma fortunes by now.Dsharma ought to be getting tired of karma fortunes by now.Dsharma ought to be getting tired of karma fortunes by now.Dsharma ought to be getting tired of karma fortunes by now.Dsharma ought to be getting tired of karma fortunes by now.Dsharma ought to be getting tired of karma fortunes by now.
 
Dsharma's Avatar
 
Posts: 48
Karma: 3254262
Join Date: Apr 2023
Device: Kindle
Hey @xav, you're on the right track! Don't worry about not being a developer, learning to navigate code can be tricky. It seems like you've understood the instructions from kovidgoyal quite well. I'd suggest to keep reviewing the BasicNewsRecipe class documentation as recommended. Remember that the options need to be set as fields in your subclass, so they should be at the same level of indentation as the 'def __init__' method. And always remember, trial and error is part of the process.
Dsharma is offline   Reply With Quote
Old 06-30-2023, 09:33 AM   #6
greg
Junior Member
greg began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Jun 2023
Device: kindle white
Is it just as effective to configure a default device, so that images get resized? I noticed the Economist download fell from 20MB+ to ~10MB when i set profile to kindle paperwhite

That said, on an older calibre install this news feed was coming in nearer 7MB - not sure what changed (other than that was calibre 5.x)
greg is offline   Reply With Quote
Old 07-09-2023, 04:25 PM   #7
xav
Member
xav began at the beginning.
 
Posts: 22
Karma: 10
Join Date: Mar 2014
Device: Kindle paperwhite 2
Quote:
Originally Posted by greg View Post
Is it just as effective to configure a default device, so that images get resized? I noticed the Economist download fell from 20MB+ to ~10MB when i set profile to kindle paperwhite

That said, on an older calibre install this news feed was coming in nearer 7MB - not sure what changed (other than that was calibre 5.x)
Thank you very much for your answers. I tried Greg's hint and changed from Preferences > Conversion > the Output profile to Kindle Paperwhite and got the last The Economist version to 6.3 Mb which is what I wanted.

Thank you very much again !
xav is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PDF is being compressed when being sent to Kobo device. zorrodee666 Calibre Companion 2 03-24-2019 02:15 AM
Compressed elements in libnickel.so PeterT Kobo Developer's Corner 5 10-05-2013 05:21 PM
Compressed Book Summaries Tony30 Deals and Resources (No Self-Promotion or Affiliate Links) 1 02-25-2013 07:57 AM
Compressed Manga albogango Sony Reader 10 09-09-2011 10:57 PM
The Economist recipe images are too large santino1980 Recipes 4 11-01-2010 03:35 PM


All times are GMT -4. The time now is 04:33 PM.


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