aboutsummaryrefslogtreecommitdiff
path: root/doc/bugs/image_rescaling_distorts_with_small_pictures.mdwn
blob: c74818a46b3255a7ab910ee4b8c0867d0274d775 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
If you use the rescaling feature of the directive [[ikiwiki/directive/img/]] with a smaller image it will distort. E.g. an image with 150x250 rescaled into size=200x200. --bastla

> More specifically: `img` normally preserves aspect ratio:
> `size=200x200` normally means "as large as possible, keeping
> the width 200px or less, the height 200px or less, and the
> aspect ratio correct". So a 4:3 image with `size=200x200`
> would actually come out 200px wide and 150px tall.
>
> However, when (desired width is specified) && (desired height is specified)
> && ((width > desired width) || (height > desired height)),
> it uses exactly the desired size, without preserving aspect ratio.
> --smcv

>> [[!template id=gitbranch branch=chrysn/imgforpdf-and-more author="[[chrysn]]"]]
>>
>> [[!tag patch]]
>>
>> i've implemented a fix for this along with a unit test.
>>
>> the patch branch is based on the imgforpdf branch
>> ([[bugs/svg and pdf conversion fails]]), because it would not cleanly merge.
>> the  branch also enhances on how images are handled in preview, falling back
>> to data: urls if the image has not been rendered in a saved version. please
>> review. --[[chrysn]]