Color Spaces - RGB, CMYK, YUV

Boudewijn Rempt boud at valdyas.org
Sat Jun 4 11:55:48 CEST 2005


On Saturday 04 June 2005 11:08, Grzegorz Borowiak wrote:
> Ehlo!
>
> I'm a programmer and an amateur movie maker.
>
> I wonder if it is possible to modify Krita in such way that it could
> handle images in YUV color space, as well as Photoshop handled CMYK, and
> if this won't disturb long term plans of Krita development.

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.

> If yes, I would gladly implement this, as I need this for FX. 

Great!

> So far I use 
> GIMP on video frames converted to RGB and I convert it back to YUV
> (conversion by mplayer/mencoder), but it is ugly. I need a tool which
> would allow me painting immediately on YUV frames.

Sounds very cool.

> 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.

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.

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). There are two essential 
paths: conversion from rgb to yuv from the color selector to get the 
paint/background color (although we might have to do something here, so 
colors selected with hsv, yuv or cmyk color selectors don't need to go 
through a conversion process -- I'll think this over), and from yuv to rgb 
for the display rendering.

* Casper is busy working on making Krita completely colorspace independent, 
and that means that the API will be extended a lot with utility methods.

* 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.

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.
-- 
Boudewijn Rempt 
http://www.valdyas.org/fading/index.cgi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kimageshop/attachments/20050604/61394ff4/attachment.pgp


More information about the kimageshop mailing list