![]() |
#1 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 78,945
Karma: 144284074
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Cover image bug with ePub for correct aspect
When I convert something to ePub and add in a cover image, the cover comes out wrong. The aspect is wrong.
The titlepage file has 600x800 resolution and that makes the cover the full width of the screen instead of aspect correct. Sure I can go in and change the resolution to the image's but I should not have to. I am using ebook-convert. Code:
ebook-convert %1 .epub margin-top=0 --margin-bottom=0 --margin-left=0 --margin-right=0 --preserve-cover-aspect-ratio --cover=cover.jpg --language=en |
![]() |
![]() |
![]() |
#2 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
|
I don't know much about that variable and how that particular area of the code works, but I know that when I enable/disable 'preserve aspect ratio' from the GUI it works as expected. Maybe do a GUI conversion and see if there are extra arguments you need to pass to the command line? All the arguments that get passed are documented in the job details.
|
![]() |
![]() |
Advert | |
|
![]() |
#3 | |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 78,945
Karma: 144284074
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
|
|
![]() |
![]() |
![]() |
#4 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,130
Karma: 91256
Join Date: Feb 2008
Location: Germany
Device: Cybook Gen3
|
I think what he's trying to say is that you should do a test case conversion in the GUI for the purpose of figuring out which arguments the GUI uses. There may be issues with the arguments you pass to ebook-convert, for example, I could see the margin=0- arguments fighting with the preserve-aspect-ratio argument and winning. If you converted via the GUI as a test, you'd be able to see, for example, if the margin arguments still get passed when you select to preserve aspect ratio.
|
![]() |
![]() |
![]() |
#5 | |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 78,945
Karma: 144284074
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
|
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
|
Sure, titlepage:
Code:
<?xml version='1.0' encoding='utf-8'?> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <meta name="calibre:cover" content="true"/> <title>Cover</title> <style type="text/css" title="override_css"> @page {padding: 0pt; margin:0pt} body { text-align: center; padding:0pt; margin: 0pt; } </style> </head> <body> <div> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="100%" height="100%" viewBox="0 0 600 800" preserveAspectRatio="xMidYMid meet"> <image width="600" height="800" xlink:href="cover.jpeg"/> </svg> </div> </body> </html> Here are the conversion options that were resolved: Code:
Convert book 1 of 1 (Ulysses) Resolved conversion options calibre version: 0.7.42 {'asciiize': False, 'author_sort': None, 'authors': None, 'base_font_size': 0.0, 'book_producer': None, 'change_justification': u'original', 'chapter': u"//*[((name()='h1' or name()='h2') and re:test(., 'chapter|book|section|part\\s+', 'i')) or @class = 'chapter']", 'chapter_mark': u'pagebreak', 'comments': None, 'cover': '/var/folders/Rm/Rm6mzVkCH6GuTtIFsFdGnU+++TI/-Tmp-/calibre_0.7.42_tmp_aO8HwV/calibre_0.7.42_VEtwPB.jpeg', 'debug_pipeline': None, 'dehyphenate': True, 'delete_blank_paragraphs': True, 'disable_font_rescaling': False, 'dont_split_on_page_breaks': False, 'enable_heuristics': False, 'epub_flatten': False, 'extra_css': None, 'extract_to': None, 'fix_indents': True, 'flow_size': 260, 'font_size_mapping': None, 'format_scene_breaks': True, 'html_unwrap_factor': 0.4, 'input_encoding': None, 'input_profile': <calibre.customize.profiles.InputProfile object at 0x106fdb690>, 'insert_blank_line': False, 'insert_metadata': False, 'isbn': None, 'italicize_common_cases': True, 'keep_ligatures': False, 'language': None, 'level1_toc': None, 'level2_toc': None, 'level3_toc': None, 'line_height': 0.0, 'linearize_tables': False, 'margin_bottom': 5.0, 'margin_left': 5.0, 'margin_right': 5.0, 'margin_top': 5.0, 'markup_chapter_headings': True, 'max_toc_links': 50, 'minimum_line_height': 120.0, 'no_chapters_in_toc': False, 'no_default_epub_cover': False, 'no_inline_navbars': False, 'no_svg_cover': False, 'output_profile': <calibre.customize.profiles.SonyReaderOutput object at 0x106fdbe90>, 'page_breaks_before': u"//*[name()='h1' or name()='h2']", 'prefer_metadata_cover': False, 'preserve_cover_aspect_ratio': True, 'pretty_print': True, 'pubdate': None, 'publisher': None, 'rating': None, 'read_metadata_from_opf': '/var/folders/Rm/Rm6mzVkCH6GuTtIFsFdGnU+++TI/-Tmp-/calibre_0.7.42_tmp_aO8HwV/calibre_0.7.42_UFn_ZV.opf', 'remove_first_image': False, 'remove_paragraph_spacing': False, 'remove_paragraph_spacing_indent_size': 1.5, 'renumber_headings': True, 'series': None, 'series_index': None, 'smarten_punctuation': False, 'sr1_replace': None, 'sr1_search': None, 'sr2_replace': None, 'sr2_search': None, 'sr3_replace': None, 'sr3_search': None, 'tags': None, 'timestamp': None, 'title': None, 'title_sort': None, 'toc_filter': None, 'toc_threshold': 6, 'unwrap_lines': True, 'use_auto_toc': False, 'verbose': 2} Manichean was correct, btw, I didn't intend for you to switch over to the GUI, just use it for debugging. |
![]() |
![]() |
![]() |
#7 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 78,945
Karma: 144284074
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
I can see the bug right there. The aspect ratio is wrong because the resolution is set to 600x800. So you get your image set to fit as though it was a 600x800 resolution image. When I change 600 and 800 to the actual resolution of the cover image, then I get the correct aspect ratio.
Code:
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="100%" height="100%" viewBox="0 0 600 800" preserveAspectRatio="xMidYMid meet"> <image width="600" height="800" xlink:href="cover.jpeg"/> Last edited by JSWolf; 01-25-2011 at 03:10 PM. |
![]() |
![]() |
![]() |
#8 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,149
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
No width and height are set to 600x800 only when preserve aspect ratio is set, which in turn sets the preserveAspectRatio property of the container <svg> element to xMidYMid meet which means that a compliant svg renderer has to render the image within the viewbox (which is also set to 600x800 while preserving the aspect ratio)
Use an epub viewer that properly implements the SVG spec, like calibre's epub viewer and you will see that the aspect ratio is indeed preserved. |
![]() |
![]() |
![]() |
#9 | |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 78,945
Karma: 144284074
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
Last edited by JSWolf; 01-27-2011 at 06:20 PM. |
|
![]() |
![]() |
![]() |
#10 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,149
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Try it and see.
|
![]() |
![]() |
![]() |
#11 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
|
My epub's covers all render fine with ADE - desktop and my Sony devices - of course it generally looks wonky on my desktop because the ADE window is generally set to a different aspect ratio than my reader, but they do render as configured. I prefer Calibre's default as that way there are no borders and the image fully fills the reader screen.
|
![]() |
![]() |
![]() |
#12 | |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 78,945
Karma: 144284074
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
|
|
![]() |
![]() |
![]() |
#13 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 78,945
Karma: 144284074
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
I tried it and it made the image way too wide. Now, I found the solution.
Code:
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="100%" height="100%" viewBox="0 0 600 800" preserveAspectRatio="xMidYMid meet"> <image width="600" height="800" xlink:href="cover.jpeg"/> |
![]() |
![]() |
![]() |
#14 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,149
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
I am unable to replicate this ADE on my machine is not changing the aspect ratio of cover images as long as preserveAspectRatio is set to xmidymid meet.
What version of ade/device are you seeing this on? |
![]() |
![]() |
![]() |
#15 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 78,945
Karma: 144284074
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
I'm seeing this on my 650 and on Windows ADE 1.7.2.1131
The first attachment (cover.jpg) is the cover being shown in the correct aspect ratio in ACDSee. The second (cover2.png) is the cover as it comes out of Calibre with the aspect ratio is supposed to be preserved. The third (cover3.jpg) is showing the cover in ADE with the correct aspect ratio when I change the numbers from 600 800 to the size of the image. As you can see, 800 600 gives an incorrect aspect ratio while using the images size gives me the correct aspect ratio. |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Auto-creation of cover image on .epub to .mobi conversion | december | Calibre | 4 | 02-10-2012 05:31 PM |
[Old Thread] Epub cover image does not display correctly | Amalthia | Calibre | 30 | 06-20-2011 11:50 AM |
Epub cover image issue | vipinpa | ePub | 18 | 05-25-2010 12:28 AM |
epub conversion - cover image | Nate the great | Calibre | 15 | 09-14-2009 05:15 PM |
Aspect ratio of Kindle cover art? | Skydog | Kindle Formats | 7 | 06-02-2009 04:46 PM |