Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You'll just have to use a bigger image. You can't really expect any program or code to draw a circle in a image that is only 2 by 2 pixels large.</p> <p>Try something bigger, like having the image 5 by 5 pixels and using a radius of 2 or 3.</p> <p>Also any reason why you don't directly draw circles on the final image? You should add an image to show us what you're trying to achieve.</p> <hr> <p>Cause I've got some interest in QR codes, I've just written this sample rendering code:</p> <pre><code>&lt;?php $qr = // The actual QR code "1111111000011010001111111". "1000001001100010001000001". "1011101000001000101011101". "1011101010001100101011101". "1011101011000100101011101". "1000001000011110001000001". "1111111010101010101111111". "0000000000110011000000000". "1100011101010111100011000". "1010000111001001000111110". "0011111000100111101001011". "0000000101001010111101001". "0100111001011011101000001". "1101000110000101100100010". "1010111010011111001111011". "1010100001110011010010101". "1010111111111111111110100". "0000000011001001100010100". "1111111011010010101011001". "1000001010110011100010011". "1011101000011111111111100". "1011101001111111011101011". "1011101000100110100100101". "1000001010100010100110001". "1111111011101000100001001"; $size = 25; // Dimension in dots $dot = 9; // Pixels per dot $img = imagecreatetruecolor($size * $dot, $size * $dot); // Enable alpha blending imagealphablending($img, true); imagesavealpha($img, true); // Allocate colors $back = imagecolorallocatealpha($img, 0, 0, 0, 127); $dots = imagecolorallocatealpha($img, 0, 64, 127, 64); // Fill the image with background/transparency imagefill($img, 0, 0, $back); // Loop over all dots and draw them: for ($y = 0, $i = 0; $y &lt; $size; $y++) { for ($x = 0; $x &lt; $size; $x++, $i++) { if ($qr[$i] == '1') { // Draw a dot? // Draw rectangles //imagefilledrectangle($img, $x * $dot, $y * $dot, ($x + 1) * $dot - 1, ($y + 1) * $dot - 1, $dots); // Draw circles imagefilledellipse($img, ($x + .5) * $dot), ($y + .5) * $dot, $dot - 1, $dot - 1, $dots); // Draw a second set of circles for more aliased dots imagefilledellipse($img, ($x + .5) * $dot, ($y + .5) * $dot, $dot - 2, $dot - 2, $dots); } } } // Save the result imagepng($img, "qr.png"); ?&gt; </code></pre> <p>This will result in the following image:</p> <p><img src="https://i.stack.imgur.com/ns1nT.png" alt="Example QR code pointing to stackoverflow.com"></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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