Colorize Images?

Hello! This came up for several projects:
The thumb() function does not support colorizing images, while the forked library SimpleImage definitely does – is there a way to make a use of that while not completely missing out on Kirbys caching options?

Thanks for any hints!

Two ways:

  1. Redefine the GD-Method Function of thumb class (Thumb::$drivers['gd'] = function($thumb){...}).
    https://github.com/getkirby/toolkit/blob/master/lib/thumb.php
  2. Wait some days, then I release a new version of my extension.
    https://github.com/fanningert/kirbycms-extension-image

Regards Thomas

Cool – thanks for the hint: I got as far as trying to include another call to simpleImage in this function – good to know, that I was on the right track.

Did you ever get this working @Paracetamol? I’m trying to use @fanningert’s plugin to colorize images in the template (rather then via the documented KirbyTag method) but with no success.

I’m a bit new to Kirby and I think I’m probably missing something quite simple here…

Many thanks for any help!

@bravokiloecho The colorize function of GD (currently I only support GD) is working only with png (I don’ know at the moment, if only the opacity or also the colore don’t work with jpg). In the future I will create a workaround code for this (jpg->png->colorize->jpg).

When you need some help with my plugin, I can create a simple example.
Here can you find the test page of the plugin. https://www.fanninger.at/thomas/works/kirbycms-extension-image (info: self signed certificate)

Thanks for your reply @fanningert.

Understood about colorize only for PNGs, and a workaround would be great if you get the chance.

As for the examples on your site, I had already seen those, and I’ve read through the documentation on the github page. However they all seem to relate to using the plugin as a KirbyTag rather than as PHP in a template. I might be missing something obvious, but would you be able to provide an example of how to use the plugin in a template?

Thank you!

@bravokiloecho
No, problem.Every function is also usable over a static method. I will create a example, when I am at home.

Ok brilliant! A static example would be really helpful, thanks!

Here are some examples. In the next days I will add other php-examples for the other exist kirby examples.
http://www.fanninger.at/thomas/works/kirbycms-extension-image

When you need a more complex example, please tell me. I will add it to my site with the solution.

This is really helpful, thanks so much! And thank you for the excellent work on the plugin itself.

Have never been able to do this but your examples seem to make our original idea possible! Will be trying it out sometime!