Page 1 of 1
How to code a transparent gradient using imagick in php?
Posted: 2011-01-25T00:12:27-07:00
by linjuming
How to code a transparent gradient using imagick in php?
Re: How to code a transparent gradient using imagick in php?
Posted: 2011-01-25T06:32:44-07:00
by magick
Code: Select all
<?php
$image = new Imagick();
$image->setSize(300,300);
$status = $image->readImage('gradient:cyan-none');
$status = $image->writeImage('gradient.png');
?>
Re: How to code a transparent gradient using imagick in php?
Posted: 2011-01-25T08:05:16-07:00
by linjuming
error infoļ¼
Re: How to code a transparent gradient using imagick in php?
Posted: 2011-01-25T08:12:52-07:00
by linjuming
Please have a look at this example:
http://www.eclecticdjs.com/mike/tutoria ... /index.php
test in my computer :
the background should be transparent which is black ,why?
Re: How to code a transparent gradient using imagick in php?
Posted: 2011-01-25T10:13:59-07:00
by magick
Try the PNG32 format rather than PNG.
Re: How to code a transparent gradient using imagick in php?
Posted: 2011-01-25T10:21:05-07:00
by linjuming
how ? can you write down the code? how to output a png32?
Re: How to code a transparent gradient using imagick in php?
Posted: 2011-01-25T10:49:15-07:00
by magick
Use $im->setImageFormat('PNG32');
Re: How to code a transparent gradient using imagick in php?
Posted: 2011-01-25T10:55:33-07:00
by linjuming
black as the same result.
Re: How to code a transparent gradient using imagick in php?
Posted: 2011-01-25T11:17:40-07:00
by magick
Let's try from the command:
- convert -size 100x100 gradient:red-transparent gradient.png
Does that work? If not, it could be your version of ImageMagick. We're using ImageMagick 6.6.7-2 and it produces an increasingly transparent gradient as expected for bother the command line and with Imagick.
Re: How to code a transparent gradient using imagick in php?
Posted: 2011-01-25T19:12:00-07:00
by linjuming
Yes , it works in command line.
Thank you very much.
but i doubt whether it can use in ajax if I use command line.
Code: Select all
<?php
$width="300";
exec("convert -size {$width}x100 gradient:red-transparent gradient.png");
if(file_exists("gradient.png")){
echo "yes";
}
?>
the code above can echo "yes";if there are many many comand lines to operate an image,can it be ok?