Search code examples
htmlcutycapt

Cutycapt and constant image size output


Hi everyone who reading this, I have problem with Cutycapt(html page into PNG image) . Does anyone knows how to "tell" CutyCapt to output image with constant size for example width must be always 1920 not less not more for image. I know what CutyCpat have parameter

--min-width=

but it could make image "width: bigger than 1920 and its not okey for me.

I tried also using div tag with specific width parameter in html page but CutyCapt again made image bigger than 1920 in width. Or at he and can someone explain me from where CutyCapt take output image size paramaters. BTW I am using CutyCapt with xvfb-run . Thanks for attention.


Solution

  • Well I faund the solution. CutyCapt do not have "tools/parameters" to make const img size(width or height for example) but if you have own html page(page what you can edit/update) you can convert it to image with const parameter/s. You need to enclose yours html page (what inside body tag)content with container . in style tag or in css set parameters of that container for example width=1920px;

    see code snipped

    <!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> 
    

    Why 1912px not 1920px if you need width 1920 for example. Well if you convert html page where width is 1920 px into img using CutyCapt your output img width will be 1928 not 1920 ,dats why you need for 8px less width parameter. I think if you change padding parameter in #container you would not need to set parameter width 8px less from needed.