Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><strong>To make the image bigger</strong>, increase the defined width. You appear to be using the default units of mm so you are specifying a width of 35 mm. If you want a bigger image, change that number to the desired width.</p> <p><strong>For a better quality image</strong>, start with a bigger image. You may have to experiment, but try 1.53<sup>1</sup> times bigger. If you make it too big, then it may look choppy when scaled.</p> <p>I would use PNG. The PNG format is better suited to images with text and solid colours like you have there. But If you want to use JPG, then <strong>try increasing the image quality</strong> with the <a href="http://www.tcpdf.org/doc/code/classTCPDF.html#a06a80145927b40683b26d9013ec8d3c6" rel="noreferrer">SetJPEGQuality()</a> method. I believe the default is 75.</p> <h1>Scaling</h1> <p>If you specify a dimension, then the image scale value is not used. If you don't want to specify the size explicitly, then set the scale factor accordingly with the <a href="http://www.tcpdf.org/doc/code/classTCPDF.html#af4e98dda815a0a7123c6480a951b4e24" rel="noreferrer">setImageScale()</a> method. So if you make your image 1.53 times bigger than the desired size, set the scale to 1.53.</p> <p><strong>Note:</strong> The description in the docs for setImageScale() is misleading, IMO. It doesn't really have anything to do with converting pixels to user units. That conversion is handled by the script internally.</p> <h1>Zoom Level</h1> <p>Be aware that the image will not look good at all zoom levels, regardless of what you do. You can set the initial zoom level with the <a href="http://www.tcpdf.org/doc/code/classTCPDF.html#ad99d9dea88f659fedf9fe11f30586a99" rel="noreferrer">SetDisplayMode()</a> method. TCPDF defaults to page width, which will be more than 100% on most modern desktops and laptops.</p> <h1>Image Size</h1> <p>The dimensions passed to the <a href="http://www.tcpdf.org/doc/code/classTCPDF.html#a714c2bee7d6b39d4d6d304540c761352" rel="noreferrer">Image()</a> method use the defined user units (default is mm). While there are some technical differences between dpi and ppi, they only apply to print. </p> <p>So for our purposes:</p> <pre><code>72 pixels = 72 points = 1 inch = 2.54 cm = 25.4 mm </code></pre> <p>Therefore, if you want an image 40 mm wide, try creating an image that is 173 pixels wide.</p> <pre><code>40 mm * 72 px / 25.4 mm * 1.53 scale factor </code></pre> <hr> <h1>Vector Images</h1> <p>If image quality is really important, you should consider using one of the vector formats. Check the TCPDF manual for <a href="http://www.tcpdf.org/doc/code/classTCPDF.html#a56536508fb1b5aede7d2ed27f56c2353" rel="noreferrer">ImageSvg()</a> or <a href="http://www.tcpdf.org/doc/code/classTCPDF.html#ace0583441eed657b827420fcfb37a3bd" rel="noreferrer">ImageEps()</a> methods.</p> <hr> <p><strong>Footnotes</strong></p> <ol> <li>I've found that at 100% zoom, there is an appreciable improvement in quality when the original image is 1.53 times bigger than the desired size. When I first started fiddling with TCPDF and image quality, I came across the number 1.53 numerous times. However, there was never any explanation as to where that number came from. I believe I have finally figured that out. Adobe Reader uses a resolution of 110 ppi by default, and TCPDF creates a document that is 72 dpi. <code>110 / 72 = 1.53</code></li> </ol>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload