![]() |
#1 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,064
Karma: 144284144
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Help with images
I have an ePub where there graphic under the chapter title. The graphic is 1200 lines long. That's fine. But what I want is for the graphic not to exceed the window which it is doing now. How can a graphic be coded such that it doesn't exceed the space reaming after the chapter title?
Below is the relevant code fo the section and the CSS code that goes with it. Code:
<h2 class="h2">CHAPTER</h2> <h2 class="h2n">Two</h2> <p class="image2"><img alt="image" src="../images/ch2.jpg"/></p> Code:
body { widows: 1; orphans: 1; margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0; text-align: justify; } img { max-width: 100%; max-height: 100%; } p { margin-top: 0; margin-bottom: 0; text-indent: 1.2em; } .h2 /*"chapter"*/ { font-size: 1em; margin-top: 0.8em; margin-bottom: 0; text-indent: 0; margin-left: 0; margin-right: 0; text-align: center; font-weight: normal; font-style: italic; } .h2n /*chapter number*/ { font-size: 1.2em; margin-top: 0; margin-bottom: 0.8em;; text-indent: 0; margin-left: 0; margin-right: 0; font-weight: bold; text-align: center; } .image2 { margin-top: 0; margin-bottom: 0; text-indent: 0; margin-left: 0; margin-right: 0; text-align: center; font-weight: normal; } |
![]() |
![]() |
![]() |
#2 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,635
Karma: 8566337
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Quote:
1) What is the size in pixels of "ch2.jpg"? 2) the code to manage "ch2.jpg", has to be full compatible with ADE (that is RMSDK)? |
|
![]() |
![]() |
![]() |
#3 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,064
Karma: 144284144
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
|
![]() |
![]() |
![]() |
#4 |
A Hairy Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,303
Karma: 20171571
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
Build the title into the image, then wrap it with SVG.
|
![]() |
![]() |
![]() |
#5 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,064
Karma: 144284144
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
|
![]() |
![]() |
![]() |
#6 |
A Hairy Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,303
Karma: 20171571
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
Photoshop the title so it is part of the image. (you can try and use the svg text element, but that takes a lot more work with viewport sizing)
Then: Code:
<div style="text-align:center; padding:0; margin:0"> <svg xmlns="http://www.w3.org/2000/svg" height="100%" width="100%" preserveAspectRatio="xMidYMid meet" version="1.1" viewBox="0 0 1200 485" xmlns:xlink="http://www.w3.org/1999/xlink"> <image width="1200" height="485" xlink:href="../Images/ch2.jpg"/> </svg> </div> Of course you could just use Sigil's "add img wrapped in svg" plugin after you photoshop the title... |
![]() |
![]() |
![]() |
#7 |
Interested in the matter
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 421
Karma: 426094
Join Date: Dec 2011
Location: Spain, south coast
Device: Pocketbook InkPad 3
|
Another chance:
Code:
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" viewBox="0 0 600 800" width="100%" height="100%" preserveAspectRatio="xMidYMid meet"> <text text-anchor="middle" font-weight="bold" font-size="48px" x="300" y="60">Claudio Bombarnac</text> <text text-anchor="middle" font-weight="bold" font-size="42px" x="300" y="120">Julio Verne</text> <image width="600" height="625" x="0" y="140" xlink:href="../Images/01.jpg"/> <text text-anchor="middle" font-size="24px" x="300" y="790">Traducción: J. Bacelar</text> </svg> |
![]() |
![]() |
![]() |
#8 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,064
Karma: 144284144
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
I'm still not seeing how this is going to work with different resolution view ports.
|
![]() |
![]() |
![]() |
#9 |
A Hairy Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,303
Karma: 20171571
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
The viewbox automagically adapts to the display size.
edit: here is a link to MR's SVG wiki. There is a section in their explaining all that. Last edited by Turtle91; 02-23-2018 at 08:42 AM. |
![]() |
![]() |
![]() |
#10 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,635
Karma: 8566337
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Quote:
1. Your image has a width of 485px and a height of 1200px. According to that, you normally would define the "viewbox" of a svg wrapper as: viewBox="0 0 485 1200" 2. But now you want to add upper captions to that image. So, the first thing you have to do is to modify the size of the viewbox, so that it will be a bit larger. Let's say that our new viewBox definition will be: viewBox="0 0 485 1325" 3. Since our image has a height of 1200px, then we need to position it at x="0" y="125" (y="125" because the height of the viewbox is 1325 and the height of image is 1200; "y" is the difference between those two measures). Then our svg wrapper would be (so far): Code:
<div style="margin:0; padding:0; text-align:center"> <svg xmlns="http://www.w3.org/2000/svg" height="100%" preserveAspectRatio="xMidYMid meet" version="1.1" viewBox="0 0 485 1325" width="100%" xmlns:xlink="http://www.w3.org/1999/xlink"> <image height="1200" width="485" x="0" y="125" xlink:href="../Images/ch2.jpg"></image></svg> </div> Code:
<div style="margin:0; padding:0; text-align:center"> <svg xmlns="http://www.w3.org/2000/svg" height="100%" preserveAspectRatio="xMidYMid meet" version="1.1" viewBox="0 0 485 1325" width="100%" xmlns:xlink="http://www.w3.org/1999/xlink"> <text text-anchor="middle" font-family="serif"> <tspan x="242" y="30" font-size="25" font-style="italic">CHAPTER</tspan> <tspan x="242" y="80" font-size="45" font-style="normal" font-weight="bold">Two</tspan> </text> <image height="1200" width="485" x="0" y="125" xlink:href="../Images/ch2.jpg"></image></svg> </div> Here you can see how it looks in ADE: Below you can check the respective epub. Regards Rubén |
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to change the Sigil Images folder name to images | davidspring | Sigil | 29 | 02-12-2018 05:00 AM |
No images | MalcolmRM | Sigil | 23 | 05-31-2014 02:11 PM |
HTML + Images = MOBI without Images | SunLight | Amazon Kindle | 5 | 08-25-2012 02:27 PM |
Images | raiderkilo | Conversion | 5 | 01-08-2012 04:14 AM |
Images | Hunterpub | Introduce Yourself | 5 | 04-13-2009 07:26 PM |