Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 03-10-2023, 07:11 AM   #1
alvarob
Junior Member
alvarob began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Feb 2023
Device: Kindle Paperwhite 11th
News sources images getting resized

Hi. I was trying to fix a .recipe file that was getting small images in my kindle paperwhite. So I made a new function so it downloads the biggest size. Then added some img css so it used the full width. But it didn't work. When I converted the .mobi file to .epub I noticed that all the images had some custom css:

Code:
.calibre_13 {
  height: 222px;
  vertical-align: baseline;
  width: 414px;
}
.calibre_14 {
  height: 252px;
  vertical-align: baseline;
  width: 414px;
}
.calibre_15 {
  height: 240px;
  vertical-align: baseline;
  width: 414px;
}
And many more like that. All with that width, 414px, preventing it from using the full screen. Why is calibre doing that? How do I stop it?

Thank you.
alvarob is offline   Reply With Quote
Old 03-10-2023, 07:24 AM   #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,066
Karma: 22669822
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
There is no 414 in calibre, its coming from the source html/css
kovidgoyal is offline   Reply With Quote
Advert
Old 03-10-2023, 09:57 AM   #3
alvarob
Junior Member
alvarob began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Feb 2023
Device: Kindle Paperwhite 11th
You're right, I was looking at the css but it seems that comes from the html.

Any idea on how to parse that from the source?
The website looks like this:

Code:
<img height="0" width="414" src="">
And I would like to remove both height and width from that tag, whatever size they specify (it can vary), leaving only

Code:
<img src="">
I guess I coud try with soup, something like

Code:
def postprocess_html(self, soup, first_fetch):
while len(soup.find_all('width')) > 0:
    soup.width.extract()
while len(soup.find_all('height')) > 0:
    soup.height.extract()
return soup
alvarob is offline   Reply With Quote
Old 03-10-2023, 10:47 AM   #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,066
Karma: 22669822
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Just add remove_attributes = ['width']

to the recipe
kovidgoyal is offline   Reply With Quote
Old 03-10-2023, 03:26 PM   #5
alvarob
Junior Member
alvarob began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Feb 2023
Device: Kindle Paperwhite 11th
Thank you!
alvarob is offline   Reply With Quote
Advert
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Limit images to be resized rubeus Plugins 3 12-06-2015 12:58 PM
Automatic news fetch: different news sources to different Kindles? kcp Calibre 4 01-24-2015 02:43 PM
News Sources sisterphonetica Recipes 5 06-27-2014 11:30 AM
[Enhancement] Add new news sources of ABC NEWS donnie888 Recipes 0 12-23-2012 12:39 AM


All times are GMT -4. The time now is 09:22 PM.


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