大家好,谁读了这篇文章,我有问题与Cutycapt(html页面到PNG图像)。谁知道如何“告诉”CutyCapt输出固定大小的图像例如图像宽度必须始终是1920,不能小于或大于1920。我知道CutyCpat有什么参数
--min-width=但它可以使图像“宽度:大于1920,这对我来说是不好的。
我还尝试在html页面中使用带有特定宽度参数的div标签,但CutyCapt再次使图像宽度大于1920。或者谁能解释一下CutyCapt从哪里获取输出图像大小参数。顺便说一句,我正在使用CutyCapt和xvfb-run。感谢您的关注。
发布于 2020-04-08 18:12:56
好吧,我找到了解决方案。CutyCapt没有“工具/参数”来设置const img大小(例如宽度或高度),但是如果你有自己的html页面(你可以编辑/更新的页面),你可以将它转换成带有const参数的图像。在容器样式标签或css设置参数中,例如width=1920px;
查看截取的代码
<!Doctype HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>fixed layout</title>
<style>
/* This is a comment it is not read by any browser
This is where the css styling goes */
body{
color:#000;
background-color:#fff;
padding:0;
margin:0;
}
#container{
/*Styling for any element with the id="container" */
width:1912px; /* The width is fixed by pixels */
color:#fff;
background-color:red;
}
</style>
</head>
<body>
<div id="container">
<p id="content"> I have a fixed width so you can only see me and the body if your monitor has enough pixels. Otherwise you will just see me, the container</p>
</div>
</body>
</html> 例如,如果你需要宽度1920,为什么1912px而不是1920px。如果你使用CutyCapt将宽度为1920px的html页面转换成img,你的输出img宽度将是1928而不是1920,这就是为什么你需要更少的8px宽度参数。我认为如果你改变#container中的填充参数,你就不需要设置比所需的宽度小8px的参数了。
https://stackoverflow.com/questions/61026704
复制相似问题