Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you meant using GD library in PHP, you should give a check on <a href="http://php.net/manual/en/function.imagefilter.php" rel="noreferrer">imagefilter()</a></p> <p>Steps are: </p> <ul> <li>Start with a .PNG image, use white for inner, alpha for outer.</li> <li>Use <code>imagefilter($img, IMG_FILTER_COLORIZE, 0, 255, 0))</code> Where 0,255,0 is your RGB color (bright green in this example)</li> <li>Save the alpha and print out result.</li> </ul> <hr> <p>Edit, Working code and clarification.</p> <p>I meant, using alpha for OUTER of the black lines, and white INSIDE. Here's the sample image: <img src="https://i.stack.imgur.com/gZt0I.png" alt="WhiteInAlphaOut"></p> <p>And here's a working code for colorizing white parts:</p> <pre><code>header('Content-Type: image/png'); /* RGB of your inside color */ $rgb = array(0,0,255); /* Your file */ $file="../test.png"; /* Negative values, don't edit */ $rgb = array(255-$rgb[0],255-$rgb[1],255-$rgb[2]); $im = imagecreatefrompng($file); imagefilter($im, IMG_FILTER_NEGATE); imagefilter($im, IMG_FILTER_COLORIZE, $rgb[0], $rgb[1], $rgb[2]); imagefilter($im, IMG_FILTER_NEGATE); imagealphablending( $im, false ); imagesavealpha( $im, true ); imagepng($im); imagedestroy($im); </code></pre> <p><em>Note</em>: We must negate values since colorize only works for non-white parts. We could have a workaround to this by having white-bordered image with black inside.</p> <p><em>Note</em>: This code only works for black-border and white-inner images.</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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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