Add filter plugin

Boudewijn Rempt boud at valdyas.org
Wed Aug 15 18:38:52 UTC 2012


Hi Daniel!

Are you getting anywhere? Or is there something we can help you with?

On Friday 03 August 2012 Aug, Daniel Johannsen wrote:
> On 03.08.2012 12:52, Boudewijn Rempt wrote:
> > On Fri, 3 Aug 2012, Daniel Johannsen wrote:
> >
> >> Hi Krita development team,
> >>
> >> i like to add a new filter plugin into Krita. Basically, it is a 
> >> desaturation filter which preserves luminance information
> >> when converting from rgb to grayscale. The algorithm constists of a 
> >> simple linear combination of the rgb values
> >> in order to derive the gray value.
> >>
> >> As a quick (and dirty) feasibility study, i altered the source file 
> >> LcmsColorSpace.h by overwriting the method call
> >>
> >> cmsDoTransform(cmstransform, const_cast<quint8 *>(src), dst, nPixels);
> >>
> >> inside the method transform in struct KoLcmsColorTransformation.
> >>
> >> While this works and changes the color of the image in the way it 
> >> supposed to, of course it is far from being
> >> an incorporation of a new filter plugin into Krita.
> >>
> >> Now,
> >> how do i add a new filter plugin into Krita the right way?
> >> Is there any documentation which explains how to write a filter 
> >> plugin? (I found only one Developing Krita Plugins,
> >> but it seems way out of date.)
> >>
> >
> > Yeah, that's very out of date... Basically, when doing a filter you 
> > have two choices: either you can use lcms' color transformations. That 
> > is mostly colorspace independent. That's where you ended up in this case.
> >
> > However, you can also implement the code right inside the filter 
> > plugin. These are in krita/plugins/filters, where you can find lots of 
> > examples. What you need to do then is to take the incoming pixels, 
> > convert them to a known colorspace (like Lab, for instance), do the 
> > algorithm, then convert it back.
> >
> > Basically, all you then need to do is implement the process() method.
> >
> > Boudewijn
> > _______________________________________________
> > kimageshop mailing list
> > kimageshop at kde.org
> > https://mail.kde.org/mailman/listinfo/kimageshop
> >
> Thank you very much for your fast answer!
> I will start by defining a new process() method and take a look at the 
> examples on how to create proper menu entries.
> 
> Motivation comes from the importance of luminance information in 
> paintings (ref. M. Livingstone).
> Let me suggest for future versions to extend the existing desaturation 
> filter in order to be able to choose among several
> color-to-gray transformation algorithms ( e.g. luminance or luminosity 
> in gimp, average, etc. ).
> 
> By the way, when invoking the desaturate filter in calligra version 
> 2.4.2, there is repeatedly the message on stdout:
> /krita(12176)/koffice: Lcms2 error:  12 Malformed struct in type 'desc' 
> for tag 'dmnd'/.
> Since the filter works, it is not a big issue.
> 
> Congratulations and thank you very much for this fantastic painting program.
> Daniel
> 


-- 
Boudewijn Rempt
http://www.valdyas.org, http://www.krita.org, http://www.boudewijnrempt.nl


More information about the kimageshop mailing list