Color Spaces - RGB, CMYK, YUV

Grzegorz Borowiak grzes at gnu.univ.gda.pl
Sat Jun 4 13:23:28 CEST 2005


Thanks for kuick answer!



On Sat, 4 Jun 2005, Boudewijn Rempt wrote:

> If there are any obstacles in the current code base of Krita that prevent
> implementing this, we'll gladly remove those. We're going for flexibility
> right now, so you're right on time.

One thing is color selector, which you mention below.

> > Could you advise me, how to do it? I planned to see how CMYK is
> > implemented, but I can't see it at work: Krita does not allow me to use
> > CMYK colorspace, although there is some code for this.
>
> Okay... In the current svn trunk cmyk is enabled again, but it's still too
> buggy to really use. Converting and rgb image to cmyk works, quite often, and
> then you can start doing things to the image.

I don't want to use CMYK practically. I just want to trace it how it
works, and implement YUV analogically.

> The best thing to do would be to keep a current checkout of Krita, copy the
> either the rgb or grayscale colorspace module to
> koffice/krita/modules/colorspace_yuv and start implementing the
> krita/core/color_strategy/kis_strategy_colorspace interface. If you prefer, I
> can make an empty template for you to start filling in. Such an empty
> template might be handy in any case.

Yes, please

> Couple of notes:
>
> * We often use lcms to convert between colorspaces. I'm not sure whether lcms
> supports yuv, if not, you need to use your own conversion routines. (Which
> my be better for this particular case, I don't know).

No problem, it's just a 3x3 matrix/vector multiplication.

> * What bugs the cmyk module most is compositing. Even painting doesn't change
> the pixels directly, but we take a small temporary layer with the brush shape
> and composite that with the original image. That only works well if there is
> support for an alpha channel in the color strategy.

I of course want to do alpha channel in YUV.

> If you haven't got svn access I can do the initial commits for you, no
> problem, and don't hesitate to ask as many questions as needed.

Could I get svn access?

------------------

On Sat, 4 Jun 2005, Bart Coppens wrote:

> Now this would be possible with krita, for the most part of it. If you know
> how, Krita would be able to display YUV frames, and you would be able to draw
> on them. As far as I know, the main problem is that at the moment, that the
> paint brush still works only in RGB,

What does tie it to RGB?

> KisPaintOp::computeDab(KisAlphaMaskSP mask) (in core/paintop/kis_paintop.cc)
> where you'll see that it uses a QColor. Now you could probably play with this
> a bit, to work around the curent limitations. But that's of course for after
> getting YUV working, I think :-)

Generally I think we could replace QColor with some KisColor class, which
would have similar interface but be more universal.

> Now as I said, the state of the CMYK code is not really very good, so it is
> probable that you will get a bit confused by it. So it's best to have a look
> at, not only CMYK code, but also the RGB(A) code (or even the Grey(A) code,
> that's very simple as it only deals with 1 channel). You can find them in the
> modules/ and core/color_strategy/ directories.

Thanks.

------------------

Notes:

* Implementing YUV seems good for other reason: JPEG 2000 is YUV-based.

* YUV requires some work at core, and it's really good moment for it.

-- 
Grzes


More information about the kimageshop mailing list