[Feature request] RGB-YIQ conversion (compose/decompose to layers)

Hi. For several months, I’ve been trying to recreate the effect of an old VHS tape in GIMP. So far I’ve got pretty nice results, but to make them more accurate, I’d need to decompose an image to YIQ channels, and then compose it back in RGB again.

I’ve searched the web, but there aren’t any programs which can do it for me. I’ve seen several pieces of code in Python, C++ and MathLab, and there are matrixes available for conversion from RGB and other formats. But, alas, at the moment there simply aren’t any standalone programs/plugins which can accomplish this task.

I’m not familiar enough with coding to make a program myself, so I’d like to request this feature in GMIC. I’d appreciate it a lot and it would help me to understand VHS better.

Thanks for the suggestion. I’ve added the RGB<->YIQ transformations in most filters, including Colors / Decompose channels, as illustrated below. Should be available in G’MIC 1.6.7+ after a filter update.

2 Likes

Thank you! This is great news! I immediately saw some very interesting results after trying it, I’m going to test it further later today.

1 Like

I’ve tried testing it further. I have GMIC v1.6.7 plugin for GIMP, I’m using it on Mac OS X.

There are two things I’ve had trouble with. First, for some reason, when I decomposed and recomposed the image back, it was missing blue/green tones. I’ve made an album with the results: http://imgur.com/a/LFiBY. I did everything as usual (the same exact actions but with YCbCr color basis produced normal results). Second, the chroma layers I got seemed a little too high in black, with only few parts in grey/white, which was very different from YCbCr/YUV decomposition (but I don’t know if it should be this way).

It is unexpected because in the picture you posted above everything looks just fine, so I’m not sure where the problem is.

I’ve tried to test it on Windows 10 x64. Unfortunately, when I update the filters, for some reason the YIQ option doesn’t appear. I have 1.6.8_pre version of GMIC plugin. I tried to find v1.6.7 just in case but couldn’t.

The RGB->YIQ and YIQ->RGB transformations do not preserve the value range, and thus, I end up with negative values (or values higher than 255) when I compute the transforms.
In this case, I have to ‘cut’ the values in range [0,255], so that GIMP can handle the image correctly (in 8bits / channel with GIMP 2.8). I guess this explains why you have differences for some color tones.
Maybe on the picture I’ve used, I had the luck to minimize the out-of-range values when computing the color transformation (there are very few blues and green in the image of lena).

1 Like

Yes, I assume this is the reason. But, don’t YUV and YCbCr have negative values too? I understand that when decomposing the images in these color spaces in GMIC, chroma values −0.5 will be presented as black, 0—grey, and +0.5—white. Can the same be applied to YIQ? I understand that it’s a little different though, because if I understand correctly I and Q’s ranges slightly exceed [-0,5, +0.5].

Cutting off the negative part brings limitations to what can be done with an image.

Yes, we can still renormalize the values in [0,255] with YIQ, maybe at the price of losing numerical precision for colors that initially fit in the [0,255] range.

1 Like

Done!
Should work OK now, after a filter refresh.

1 Like

Thank you very much! It works great now. Tried several images, everything works perfectly. Can’t wait to try it on VHS images I have, I really like it.