contao/imagine-svg

No Documentation to use Colorize method?

rashidaghadiinfotech opened this issue · 2 comments

How can I change the color of Black SVG to any RGB color?
I am using this library for modifying size and getting the size. What is the way to change fill color of SVG?

`$imagine = new Imagine();
$image = $imagine->open($svg_file);
$image->resize(new Box(300, 300));

// $image->effects()->colorize($image->palette(), array(255,0,0));

$image->save($file_path);`

So what is the solution to change it to color we want? I have no idea about using colorize method properly.

ausi commented

You can find the documentation here: https://imagine.readthedocs.io/en/stable/usage/effects.html

$image->effects()->colorize($image->palette()->color('#FF0000'));

@ausi
Thank you for this help. It worked magically.