![]() |
#1 |
Junior Member
![]() Posts: 2
Karma: 10
Join Date: Jan 2022
Device: Kobo Libra 2
|
convert imgage *px to max-height/width
Hi guys,
A book has all its images(over 1 hundred, each with it's own class) defined like: Code:
.calibre10 {height: 256px, width: 200px} Code:
.calibre10 {max-height: 100%, max-width: 90%} change property height to max-height if it's greater than 10px or if the property height matches pattern like "height: /\d{2,3}[p][x]/gm" regexpression; They don't work. Anyone can help? |
![]() |
![]() |
![]() |
#2 |
Groupie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 167
Karma: 1497966
Join Date: Jul 2021
Device: N/A
|
Do you mean ?:
Code:
.calibre10 {height: 256px; width: 200px} (semicolon, not comma). Code:
search: (height):\s*\d{2,}px;(\s*)(width):\s*\d{2,}px replace: max-\1: 100%;\2max-\3: 90% (select: current file or all style files) It's probably better to put one of the two dimensions in auto. Now, e-readers often tend to recognize better width than height. For landscape, it's obvious, width should be 100% . For portrait, it' not that easy, but I think that there is a sigil plugin that can calculate the right width in relation with the real size of the picture. Last edited by lomkiri; 01-24-2022 at 02:17 PM. |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Junior Member
![]() Posts: 2
Karma: 10
Join Date: Jan 2022
Device: Kobo Libra 2
|
Thank you, Lomkiri!
Yes, it should be semi-colon. I tried searching on the style CSS file, it can't find any match. My book is written in Traditional Chinese which is in vertical writing mode and is read from right to left. Height is more relevant on images. I had another try of "transform style" tool, it works this time although images smaller than 10px are dismissed. |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Image resizing issues while using max-height/max-width | Detroa | ePub | 22 | 08-26-2020 06:17 PM |
some basic questions about width/height/size | angharad09 | Workshop | 1 | 08-18-2020 10:39 AM |
Resizing images, retaining width-height rato, and only if necessary. | Vanguard3000 | Sigil | 7 | 07-31-2015 10:43 AM |
Flightcrew : is px for the height/width forbidden ? | NicolasR | Sigil | 2 | 02-11-2011 03:51 AM |
WIDTH and HEIGHT in <img> tags | Pablo | Sigil | 3 | 06-10-2010 05:37 PM |