# Compute White Underprint Values

I want to print this motif on a grey hoodie using DTG, how would I compute the color values for the white underprint to make the colors on grey fabric approximate the colors in the image? My intuition is, after converting to CMYK (assuming no pixel has positive values in all four channels), I subtract the K value of the background grey from the K value of each pixels, the negative K values give me exactly the intensity of the white underprint needed to represent the color. Is that somewhat correct? [EDIT] My back of an envelope calculation went like following. Assume for simplicity that every layer tranlucent print of color S ∈ {C, M, Y, K} lets light of color A ∈ {R, G, B} pass at rate S(A). Assume further that the fabric reflects light of color A at rate F(A), and a layer of white print on the fabric with opacity w reflects light of color A at rate w + (1 - w) F(A). So a standard CMYK conversion of the RGB image with corresponding values r, g, b would tell us what values c, m, y, k approximate a ~ (c C(A))² (m M(A))² (y Y(A))² (k K(A))² for (a, A) ∈ {(r, R), (g, G), (b, B)}. We want to find values c', m', y', k', w to approximate a ~ (c' C(A))² (m' M(A))² (y' Y(A))² (k' K(A))² (w + (1 - w) F(A)) for (a, A) ∈ {(r, R), (g, G), (b, B)}. To have the grey being transparent, we must further assume that approximating a := F(A) gives all zeros.

• Are you looking to print JUST the rainbow parts on the shirt, or the while OpenGL logo? And what type of files do you have for the logo? anything layered? – Alith7 Sep 15 '20 at 18:04
• Right now it's RGB, nothing layered. I want to have it look on the grey sweater approximately as it looks on the file, with the grey background translating to transparent (i.e. no rectangle on the fabric). – fweth Sep 15 '20 at 18:06
• It is a one to many conversion. But this is in fact a really hard problem because of reasons. I have once atempted a similar thing witg our DTG and it took me weeks to get it right even though i tecnically kew what i was doing. – joojaa Sep 15 '20 at 20:41
• Interesting! But having a translucent white channel is at least theoretically possible with DTG, right? – fweth Sep 16 '20 at 6:19
• @fweth, no need to delete the question. If the answers cleared up some misunderstanding it can help others who has the same idea. – Wolff Sep 16 '20 at 8:27

I can show you one way (out of several) to remove the gray background color from the image, but I'm not sure if the resulting image will work for a shirt print.

In RGB, just add a layer on top of the image filled with the same gray color as the image and set the new layer's Blend Mode to Divide.

Optionally use a Levels adjustment layer or similar to add some contrast to the image.

Now the problem is that if the printer adds solid white under each pixel which has some other color than white, the result won't look like the original image.

Here I try to show how it would look by first grouping the layers from before. Then pasting in a cotton fabric background and finally double-clicking the group and use Blend If to make every completely white pixel transparent. The logo contains some darker gray areas which I try to remove by altering the Levels layer, but this exposes the bad quality of the image. Perhaps your original is better than the compressed version I downloaded.

If the result was better you could perhaps add back some of the removed gray color, but I think the difference between gray fabric and gray print would always be visible. Even if you somehow managed to get the exact tone, there would still be a difference in texture.

Perhaps you should forget getting the exact colors of the original and just print the result from my first gif (with the gray removed) directly on a (not too dark) gray shirt. It could look a little like this:

It won't look like the original image, but it would be a "pure" solution without any trickery needed.

It will probably be a good idea to ask the manufacturer about which method would give the best result.

### Edit due to edit in the original question

You have added some calculations to your question for calculating the values for the white channel. I don't fully understand. Maybe the math makes sense, but I think you misunderstand how the print is made physically.

I'm not an expert in DTG print (I work with offset and digital print), but I believe that like all other kinds of print you can really only print in 1-bit. Ink or no ink. So all tints are made with some kind of screen pattern. The CMYK colors are transparent so it works well to overlap the inks, but the white is opaque and is normally just used at 100%. (Others please correct me if I'm wrong.)

Let me show you an example of what I mean. Let's assume you wanted to print a magenta gradient on a gray shirt.

If you just printed the magenta directly on the fabric you wouldn't get the intended result.

So you want to add some white opaque ink underneath.

You hope to get the following result.

In reality we can't print tints of colors. We can only print in 1-bit. Either there is ink or there is no ink. So we have to use some kind of screen pattern to simulate tints. I don't know which pattern DTG uses, so here I've just used traditional halftone screening. The issues should be similar.

We would have to print the opaque white first.

And then print the transparent magenta on top.

As you see this method have some limitations. In some places you see the magenta on top of fabric other places it's on top of white. In some places the white doesn't have magenta on top and shines through. Even a tiny white dot lights up on the dark fabric and the gradient doesn't fade out seamlessly. It doesn't quite give the intended result.

• This is where i would start. – joojaa Sep 15 '20 at 20:43
• I thought someone might know a possible way. The only thing I noticed is it looks like it made the rainbow lose some of the smoothness. – Alith7 Sep 15 '20 at 20:49
• @Alith7, yeah it does do that. An alternative to using a gray layer could be to use a Black & White filter with the preset Maximum White and the Blend Mode set to Divide, but in this case I didn't think it gave a better result. Besides that the image is pretty compressed to begin with and the gray "overlay" in the original perhaps camouflages the lack of smoothness which is exposed when you see it on white background? – Wolff Sep 15 '20 at 21:12
• Thanks for the detailed explanation! But I don't want to just remove the grey, I want to additionally compute the values for the white underprint. See the edit to my question. This should be a function which takes R, G, B values and puts out C, M, Y, K, W. – fweth Sep 16 '20 at 6:06
• @fweth, I've added an example. Please tell me if this makes sense or if I misunderstand you. – Wolff Sep 16 '20 at 9:24

If that is all that you have for the logo, good luck. Any printer that you send that to is going to print you a big rectangle and flood white behind it. There's nothing else that they can do. Even if they do try to print white just under the rainbow parts, that file would still print CMYK to make the grey rectangle and show up on the shirt. That's how the print works.

You can't do what you intend with that image. When you convert that to CMYK the "grey" isn't just in the K channel, it will be in all four with no easy way to separate it out.

If you want to print Just the rainbow haloing, or even to print the isolated OpenGL logo, you are going to have to recreate this in some way that doesn't have the grey in it, only the parts you want to print. Once you have that on a white background (Photoshop) or as vector art with gradients (Illustrator), the printer will have a setting in the software for "Pixel Match" or something similar that tells the printer to print white behind anywhere it's printing CMYK.

• Thanks for the answer! I know of course that the grey has to go. I was just wondering which formula works best to represent the process. If CMYK grey has values in all four channels, that is no problem, I can do a 'stupid' conversion first, where I set the CMY values to the inverse of the RGB values, then compute for each pixel the minimal value in all channels, put that to K and subtract it from the rest, so I have a toy CMYK representation in which no pixel has positive values in all four channels. – fweth Sep 15 '20 at 18:21
• that's not how it works... If your original Image was CMYK with the grey being in ONLY the K channel then yes, this would very easy. However, having only an RGB image, you can't really separate it out, because there isn't really any way to isolate it out. I could be wrong. Someone else on here might know a way that I don't. But in my 20 years of graphics experience, with what you have, about your only options are to either recreate the logo, or very carefully manually select and remove the background with either magic wand or the eraser. – Alith7 Sep 15 '20 at 18:25
• A very simple conversation would be to first convert to CMY by inverting the channels, i.e. C corresponds to 1 - R, M to 1 - G and Y to 1 - B. Then I'd take the minimal value of the CMY channels to be K and subtract that value from the other channels. – fweth Sep 16 '20 at 6:04