If a svg image has a small height, Puppeteer / Chromium will render it with a top margin and the screenshot for the png image at 0:0 position will end in a transparent image or partially cut image
This is because svg is an inline element and vertical-align is baseline and font-size is 16px by default
This PR fix it by style the svg element vertical-align: top
Example image
If a
svg
image has a small height,Puppeteer
/Chromium
will render it with a top margin and the screenshot for thepng
image at0:0
position will end in a transparent image or partially cut imageThis is because
svg
is aninline
element andvertical-align
isbaseline
andfont-size
is16px
by defaultThis PR fix it by style the
svg
elementvertical-align: top
More infos at https://stackoverflow.com/questions/22337292/spurious-margin-on-svg-element#answer-22337325
The tests are already broken before in your
master
/develop
branchMay https://github.com/neocotic/convert-svg/issues/59 is also fixed with this PR