Replies: 1 comment
-
Hi, Unfortunately there isn't much in there to support CMYK. Images are centered around RGB(A). You could convert an image to CMYK by making it a 4 channel image (traditionally RGBA), convert it to CMYK yourself, and treating the 4 channels like CMYK. But none of the filter functions know about CMYK. You could convert an image to CMYK using something like import 'dart:math';
Image convertToCMYK(Image rgbImage) {
final cmykImage = rgbImage.convert(numChannels: 4);
for (final p in cmykImage) {
final nr = p.rNormalized;
final ng = p.gNormalized;
final nb = p.bNormalized;
final k = 1.0 - max(max(nr, ng), nb);
final c = k == 0.0 ? 0.0 : (1.0 - nr - k) / (1.0 - k);
final m = k == 0.0 ? 0.0 : (1.0 - ng - k) / (1.0 - k);
final y = k == 0.0 ? 0.0 : (1.0 - nb - k) / (1.0 - k);
p.rNormalized = c;
p.gNormalized = m;
p.bNormalized = y;
p.aNormalized = k;
}
return cmykImage;
} This is just theoretical, I haven't tested it. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I've created some tools using this library for generating print material, however I've realised I need to really be handling CMYK colours rather than RGB so the material will look brighter and will give more reliable results.
Is there a way to do this? I'm using functions such as like getPixelRgb / setPixelRgba for masking. The abstract
Color
class only mentions rgb.Thanks
Beta Was this translation helpful? Give feedback.
All reactions