Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I used Marc B's advice, and called upon The GIMP to do this for me. If anyone else cares, here's the code I used:</p> <pre class="lang-lisp prettyprint-override"><code>/** * Call upon The GIMP to apply a dropshadow to a given image. * * NOTE: This will overwrite the image file at $filename! Be sure to make a copy * of this file first if you need one. * * @param string $filename * @param int $offset_x * @param int $offset_y * @param float $radius * @param array $color * @param int $opacity * @return type * @todo Resize the canvas so there's room to apply dropshadows to images which have no whitespace around them. */ function apply_gimp_dropshadow($filename,$offset_x=8,$offset_y=8,$radius=15,$color=false,$opacity=40) { if(!is_array($color)) $color = array(0,0,0); $color = join(' ',$color); $gimpScript = &lt;&lt;&lt;END_OF_SCHEME_CODE_OH_HOW_I_HATE_YOU_SCHEME (define (dropshadow filename) (let* ( (image (car (gimp-file-load RUN-NONINTERACTIVE filename filename))) (drawable (car (gimp-image-get-active-layer image))) ) (script-fu-drop-shadow image drawable 8 8 15 '($color) 40 FALSE) (set! drawable (car (gimp-image-merge-visible-layers image 0))) (gimp-file-save RUN-NONINTERACTIVE image drawable filename filename) (gimp-image-delete image) ) ) (dropshadow "$filename") (gimp-quit 0) END_OF_SCHEME_CODE_OH_HOW_I_HATE_YOU_SCHEME; $descriptorspec = array( 0 =&gt; array("pipe", "r"), // stdin is a pipe that the child will read from 1 =&gt; array("pipe", "w"), // stdout is a pipe that the child will write to ); $cwd = '/tmp'; $gimp = proc_open('/usr/bin/gimp -i -b -', $descriptorspec, $pipes, $cwd); if (!is_resource($gimp)) throw new Exception('Could not open a pipe to GIMP'); fwrite($pipes[0], $gimpScript); fclose($pipes[0]); $gimpOutput = stream_get_contents($pipes[1]); fclose($pipes[1]); $gimpResult = proc_close($gimp); return $gimpResult; } </code></pre>
 

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