0

在我的 Ubuntu 机器上,我安装了 htlm2ps 以便将简单的 html 文件转换为 GIF。我的 html 文件如下所示:

<!DOCTYPE html> 
    <html lang='en'> 
    <head>
        <meta charset="utf-8">
    </head>
    <body style="width: 120px; height: 90px" >
     <div>
         <div>Gas Prices</div>
         <div>Todays local Prices</div>
         <div>Low Price&nbsp; &nbsp; &nbsp; &nbsp; 1.29</div>
         <div>High Price&nbsp; &nbsp; &nbsp; &nbsp; 1.44</div>
     </div> 
    </body>
 </html>

我像这样运行转换:

convert -size 120x90 gas.html gas.gif

但是,生成的图像总是大小为 612x712。转换为 PNG 或 JPG 时也是如此。

任何想法我做错了什么?

4

1 回答 1

0

The -size option in Imagemagick is ignored as the page size is determined by html2ps converting the HTML into PostScript. I believe you'll need to set the size of the page with CSS within the document. See @paper option under html2ps's documentation.

/* 
  Check your version of html2ps, as @paper my have been replace with @page selector
 */
@paper {
    width: 120px;
    height: 90px;
    /* Note: Units may need to be converted to `em' or `pt' */
}
于 2014-01-21T14:38:22.493 回答