Class CmykColorHelper
Il nome: Aspose.Imaging Assemblea: Aspose.Imaging.dll (25.4.0)
Metodi di aiuto per lavorare con il colore CMYK presentato come un valore integrale di 32 bit firmato.Fornisce l’API simile al Aspose.Imaging.CmykColor strumento.È più leggero perché il colore CMYK è presentato come Int32 piuttosto che la struttura con campi interni.Si prega di utilizzare i metodi statici di questa classe quando possibile piuttosto che i deprezzati.Aspose.Imaging.CmykColor strumento.
public static class CmykColorHelper
Inheritance
I membri ereditari
object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()
Methods
FromComponents(int, int, int, int)
Crea CMYK da un valore 32-bit cyan, magenta, giallo e nero.
public static int FromComponents(int cyan, int magenta, int yellow, int black)
Parameters
cyan
int
I valori validi sono da 0 a 255.
magenta
int
I valori validi sono da 0 a 255.
yellow
int
I valori validi sono da 0 a 255.
black
int
I valori validi sono da 0 a 255.
Returns
Il colore CMYK è presentato come un valore integrale di 32 bit.
Examples
L’esempio seguente mostra come convertire i colori CMYK ai loro colleghi RGB in modo rapido seguendo formule semplici senza utilizzare i profili ICC.
int[] cmykColors = new int[]
{
Aspose.Imaging.CmykColorHelper.FromComponents(255, 0, 0, 0), // Cyan
Aspose.Imaging.CmykColorHelper.FromComponents(0, 255, 0, 0), // Magenta
Aspose.Imaging.CmykColorHelper.FromComponents(0, 0, 255, 0), // Yellow
Aspose.Imaging.CmykColorHelper.FromComponents(0, 0, 0, 255), // Black
};
System.Console.WriteLine("Convert CMYK to RGB without using ICC profiles.");
foreach (int cmykColor in cmykColors)
{
Aspose.Imaging.Color rgbColor = Aspose.Imaging.CmykColorHelper.ToArgb(cmykColor);
int c = Aspose.Imaging.CmykColorHelper.GetC(cmykColor);
int m = Aspose.Imaging.CmykColorHelper.GetM(cmykColor);
int y = Aspose.Imaging.CmykColorHelper.GetY(cmykColor);
int k = Aspose.Imaging.CmykColorHelper.GetK(cmykColor);
System.Console.WriteLine("CMYK({0},{1},{2},{3})\t\t=> RGB({4},{5},{6})", c, m, y, k, rgbColor.R, rgbColor.G, rgbColor.B);
}
//The output looks like this:
//Convert CMYK to RGB without using ICC profiles.
//CMYK(255,0,0,0) => RGB(0,255,255)
//CMYK(0,255,0,0) => RGB(255,0,255)
//CMYK(0,0,255,0) => RGB(255,255,0)
//CMYK(0,0,0,255) => RGB(0,0,0)
GTC(int)
Riceve il valore del componente cyanico.
public static int GetC(int cmyk)
Parameters
cmyk
int
Il colore CMYK è presentato come un valore integrale di 32 bit.
Returns
Il valore del componente cyanico.
Examples
L’esempio seguente mostra come convertire i colori RGB ai loro colleghi CMYK senza applicare i profili ICC.
Aspose.Imaging.Color[] rgbColors = new Aspose.Imaging.Color[]
{
Aspose.Imaging.Color.Red,
Aspose.Imaging.Color.Green,
Aspose.Imaging.Color.Blue,
};
System.Console.WriteLine("Convert RGB to CMYK without using ICC profiles.");
foreach (Aspose.Imaging.Color rgbColor in rgbColors)
{
int cmyk = Aspose.Imaging.CmykColorHelper.ToCmyk(rgbColor);
int c = Aspose.Imaging.CmykColorHelper.GetC(cmyk);
int m = Aspose.Imaging.CmykColorHelper.GetM(cmyk);
int y = Aspose.Imaging.CmykColorHelper.GetY(cmyk);
int k = Aspose.Imaging.CmykColorHelper.GetK(cmyk);
System.Console.WriteLine("RGB({0},{1},{2})\t\t=> CMYK({3},{4},{5},{6})", rgbColor.R, rgbColor.G, rgbColor.B, c, m, y, k);
}
//The output looks like this:
//Convert RGB to CMYK without using ICC profiles.
//RGB(255,0,0) => CMYK(0,255,255,0)
//RGB(0,128,0) => CMYK(255,0,255,127)
//RGB(0,0,255) => CMYK(255,255,0,0)
L’esempio seguente mostra come convertire i colori CMYK ai loro colleghi RGB in modo rapido seguendo formule semplici senza utilizzare i profili ICC.
int[] cmykColors = new int[]
{
Aspose.Imaging.CmykColorHelper.FromComponents(255, 0, 0, 0), // Cyan
Aspose.Imaging.CmykColorHelper.FromComponents(0, 255, 0, 0), // Magenta
Aspose.Imaging.CmykColorHelper.FromComponents(0, 0, 255, 0), // Yellow
Aspose.Imaging.CmykColorHelper.FromComponents(0, 0, 0, 255), // Black
};
System.Console.WriteLine("Convert CMYK to RGB without using ICC profiles.");
foreach (int cmykColor in cmykColors)
{
Aspose.Imaging.Color rgbColor = Aspose.Imaging.CmykColorHelper.ToArgb(cmykColor);
int c = Aspose.Imaging.CmykColorHelper.GetC(cmykColor);
int m = Aspose.Imaging.CmykColorHelper.GetM(cmykColor);
int y = Aspose.Imaging.CmykColorHelper.GetY(cmykColor);
int k = Aspose.Imaging.CmykColorHelper.GetK(cmykColor);
System.Console.WriteLine("CMYK({0},{1},{2},{3})\t\t=> RGB({4},{5},{6})", c, m, y, k, rgbColor.R, rgbColor.G, rgbColor.B);
}
//The output looks like this:
//Convert CMYK to RGB without using ICC profiles.
//CMYK(255,0,0,0) => RGB(0,255,255)
//CMYK(0,255,0,0) => RGB(255,0,255)
//CMYK(0,0,255,0) => RGB(255,255,0)
//CMYK(0,0,0,255) => RGB(0,0,0)
Il ghetto(int)
Riceve il valore del componente nero.
public static int GetK(int cmyk)
Parameters
cmyk
int
Il colore CMYK è presentato come un valore integrale di 32 bit.
Returns
Il valore del componente nero.
Examples
L’esempio seguente mostra come convertire i colori RGB ai loro colleghi CMYK senza applicare i profili ICC.
Aspose.Imaging.Color[] rgbColors = new Aspose.Imaging.Color[]
{
Aspose.Imaging.Color.Red,
Aspose.Imaging.Color.Green,
Aspose.Imaging.Color.Blue,
};
System.Console.WriteLine("Convert RGB to CMYK without using ICC profiles.");
foreach (Aspose.Imaging.Color rgbColor in rgbColors)
{
int cmyk = Aspose.Imaging.CmykColorHelper.ToCmyk(rgbColor);
int c = Aspose.Imaging.CmykColorHelper.GetC(cmyk);
int m = Aspose.Imaging.CmykColorHelper.GetM(cmyk);
int y = Aspose.Imaging.CmykColorHelper.GetY(cmyk);
int k = Aspose.Imaging.CmykColorHelper.GetK(cmyk);
System.Console.WriteLine("RGB({0},{1},{2})\t\t=> CMYK({3},{4},{5},{6})", rgbColor.R, rgbColor.G, rgbColor.B, c, m, y, k);
}
//The output looks like this:
//Convert RGB to CMYK without using ICC profiles.
//RGB(255,0,0) => CMYK(0,255,255,0)
//RGB(0,128,0) => CMYK(255,0,255,127)
//RGB(0,0,255) => CMYK(255,255,0,0)
L’esempio seguente mostra come convertire i colori CMYK ai loro colleghi RGB in modo rapido seguendo formule semplici senza utilizzare i profili ICC.
int[] cmykColors = new int[]
{
Aspose.Imaging.CmykColorHelper.FromComponents(255, 0, 0, 0), // Cyan
Aspose.Imaging.CmykColorHelper.FromComponents(0, 255, 0, 0), // Magenta
Aspose.Imaging.CmykColorHelper.FromComponents(0, 0, 255, 0), // Yellow
Aspose.Imaging.CmykColorHelper.FromComponents(0, 0, 0, 255), // Black
};
System.Console.WriteLine("Convert CMYK to RGB without using ICC profiles.");
foreach (int cmykColor in cmykColors)
{
Aspose.Imaging.Color rgbColor = Aspose.Imaging.CmykColorHelper.ToArgb(cmykColor);
int c = Aspose.Imaging.CmykColorHelper.GetC(cmykColor);
int m = Aspose.Imaging.CmykColorHelper.GetM(cmykColor);
int y = Aspose.Imaging.CmykColorHelper.GetY(cmykColor);
int k = Aspose.Imaging.CmykColorHelper.GetK(cmykColor);
System.Console.WriteLine("CMYK({0},{1},{2},{3})\t\t=> RGB({4},{5},{6})", c, m, y, k, rgbColor.R, rgbColor.G, rgbColor.B);
}
//The output looks like this:
//Convert CMYK to RGB without using ICC profiles.
//CMYK(255,0,0,0) => RGB(0,255,255)
//CMYK(0,255,0,0) => RGB(255,0,255)
//CMYK(0,0,255,0) => RGB(255,255,0)
//CMYK(0,0,0,255) => RGB(0,0,0)
GETM(int)
Ricevi il valore del componente magenta.
public static int GetM(int cmyk)
Parameters
cmyk
int
Il colore CMYK è presentato come un valore integrale di 32 bit.
Returns
Il valore del componente magenta.
Examples
L’esempio seguente mostra come convertire i colori RGB ai loro colleghi CMYK senza applicare i profili ICC.
Aspose.Imaging.Color[] rgbColors = new Aspose.Imaging.Color[]
{
Aspose.Imaging.Color.Red,
Aspose.Imaging.Color.Green,
Aspose.Imaging.Color.Blue,
};
System.Console.WriteLine("Convert RGB to CMYK without using ICC profiles.");
foreach (Aspose.Imaging.Color rgbColor in rgbColors)
{
int cmyk = Aspose.Imaging.CmykColorHelper.ToCmyk(rgbColor);
int c = Aspose.Imaging.CmykColorHelper.GetC(cmyk);
int m = Aspose.Imaging.CmykColorHelper.GetM(cmyk);
int y = Aspose.Imaging.CmykColorHelper.GetY(cmyk);
int k = Aspose.Imaging.CmykColorHelper.GetK(cmyk);
System.Console.WriteLine("RGB({0},{1},{2})\t\t=> CMYK({3},{4},{5},{6})", rgbColor.R, rgbColor.G, rgbColor.B, c, m, y, k);
}
//The output looks like this:
//Convert RGB to CMYK without using ICC profiles.
//RGB(255,0,0) => CMYK(0,255,255,0)
//RGB(0,128,0) => CMYK(255,0,255,127)
//RGB(0,0,255) => CMYK(255,255,0,0)
L’esempio seguente mostra come convertire i colori CMYK ai loro colleghi RGB in modo rapido seguendo formule semplici senza utilizzare i profili ICC.
int[] cmykColors = new int[]
{
Aspose.Imaging.CmykColorHelper.FromComponents(255, 0, 0, 0), // Cyan
Aspose.Imaging.CmykColorHelper.FromComponents(0, 255, 0, 0), // Magenta
Aspose.Imaging.CmykColorHelper.FromComponents(0, 0, 255, 0), // Yellow
Aspose.Imaging.CmykColorHelper.FromComponents(0, 0, 0, 255), // Black
};
System.Console.WriteLine("Convert CMYK to RGB without using ICC profiles.");
foreach (int cmykColor in cmykColors)
{
Aspose.Imaging.Color rgbColor = Aspose.Imaging.CmykColorHelper.ToArgb(cmykColor);
int c = Aspose.Imaging.CmykColorHelper.GetC(cmykColor);
int m = Aspose.Imaging.CmykColorHelper.GetM(cmykColor);
int y = Aspose.Imaging.CmykColorHelper.GetY(cmykColor);
int k = Aspose.Imaging.CmykColorHelper.GetK(cmykColor);
System.Console.WriteLine("CMYK({0},{1},{2},{3})\t\t=> RGB({4},{5},{6})", c, m, y, k, rgbColor.R, rgbColor.G, rgbColor.B);
}
//The output looks like this:
//Convert CMYK to RGB without using ICC profiles.
//CMYK(255,0,0,0) => RGB(0,255,255)
//CMYK(0,255,0,0) => RGB(255,0,255)
//CMYK(0,0,255,0) => RGB(255,255,0)
//CMYK(0,0,0,255) => RGB(0,0,0)
di GetY(int)
Ricevi il valore del componente giallo.
public static int GetY(int cmyk)
Parameters
cmyk
int
Il colore CMYK è presentato come un valore integrale di 32 bit.
Returns
Il valore del componente giallo.
Examples
L’esempio seguente mostra come convertire i colori RGB ai loro colleghi CMYK senza applicare i profili ICC.
Aspose.Imaging.Color[] rgbColors = new Aspose.Imaging.Color[]
{
Aspose.Imaging.Color.Red,
Aspose.Imaging.Color.Green,
Aspose.Imaging.Color.Blue,
};
System.Console.WriteLine("Convert RGB to CMYK without using ICC profiles.");
foreach (Aspose.Imaging.Color rgbColor in rgbColors)
{
int cmyk = Aspose.Imaging.CmykColorHelper.ToCmyk(rgbColor);
int c = Aspose.Imaging.CmykColorHelper.GetC(cmyk);
int m = Aspose.Imaging.CmykColorHelper.GetM(cmyk);
int y = Aspose.Imaging.CmykColorHelper.GetY(cmyk);
int k = Aspose.Imaging.CmykColorHelper.GetK(cmyk);
System.Console.WriteLine("RGB({0},{1},{2})\t\t=> CMYK({3},{4},{5},{6})", rgbColor.R, rgbColor.G, rgbColor.B, c, m, y, k);
}
//The output looks like this:
//Convert RGB to CMYK without using ICC profiles.
//RGB(255,0,0) => CMYK(0,255,255,0)
//RGB(0,128,0) => CMYK(255,0,255,127)
//RGB(0,0,255) => CMYK(255,255,0,0)
L’esempio seguente mostra come convertire i colori CMYK ai loro colleghi RGB in modo rapido seguendo formule semplici senza utilizzare i profili ICC.
int[] cmykColors = new int[]
{
Aspose.Imaging.CmykColorHelper.FromComponents(255, 0, 0, 0), // Cyan
Aspose.Imaging.CmykColorHelper.FromComponents(0, 255, 0, 0), // Magenta
Aspose.Imaging.CmykColorHelper.FromComponents(0, 0, 255, 0), // Yellow
Aspose.Imaging.CmykColorHelper.FromComponents(0, 0, 0, 255), // Black
};
System.Console.WriteLine("Convert CMYK to RGB without using ICC profiles.");
foreach (int cmykColor in cmykColors)
{
Aspose.Imaging.Color rgbColor = Aspose.Imaging.CmykColorHelper.ToArgb(cmykColor);
int c = Aspose.Imaging.CmykColorHelper.GetC(cmykColor);
int m = Aspose.Imaging.CmykColorHelper.GetM(cmykColor);
int y = Aspose.Imaging.CmykColorHelper.GetY(cmykColor);
int k = Aspose.Imaging.CmykColorHelper.GetK(cmykColor);
System.Console.WriteLine("CMYK({0},{1},{2},{3})\t\t=> RGB({4},{5},{6})", c, m, y, k, rgbColor.R, rgbColor.G, rgbColor.B);
}
//The output looks like this:
//Convert CMYK to RGB without using ICC profiles.
//CMYK(255,0,0,0) => RGB(0,255,255)
//CMYK(0,255,0,0) => RGB(255,0,255)
//CMYK(0,0,255,0) => RGB(255,255,0)
//CMYK(0,0,0,255) => RGB(0,0,0)
ToArgb(int[])
La conversione da colori CMYK a colori ARGB.
public static Color[] ToArgb(int[] cmykPixels)
Parameters
cmykPixels
int
[ ]
I colori CMYK sono presentati come valori integrali a 32 bit.
Returns
Color [ ]
I colori ARGB.
ToArgb(int)
La conversione da colore CMYK a colore ARGB.
public static Color ToArgb(int cmykPixel)
Parameters
cmykPixel
int
Il colore CMYK è presentato come un valore integrale di 32 bit.
Returns
Il colore ARGB.
Examples
L’esempio seguente mostra come convertire i colori CMYK ai loro colleghi RGB in modo rapido seguendo formule semplici senza utilizzare i profili ICC.
int[] cmykColors = new int[]
{
Aspose.Imaging.CmykColorHelper.FromComponents(255, 0, 0, 0), // Cyan
Aspose.Imaging.CmykColorHelper.FromComponents(0, 255, 0, 0), // Magenta
Aspose.Imaging.CmykColorHelper.FromComponents(0, 0, 255, 0), // Yellow
Aspose.Imaging.CmykColorHelper.FromComponents(0, 0, 0, 255), // Black
};
System.Console.WriteLine("Convert CMYK to RGB without using ICC profiles.");
foreach (int cmykColor in cmykColors)
{
Aspose.Imaging.Color rgbColor = Aspose.Imaging.CmykColorHelper.ToArgb(cmykColor);
int c = Aspose.Imaging.CmykColorHelper.GetC(cmykColor);
int m = Aspose.Imaging.CmykColorHelper.GetM(cmykColor);
int y = Aspose.Imaging.CmykColorHelper.GetY(cmykColor);
int k = Aspose.Imaging.CmykColorHelper.GetK(cmykColor);
System.Console.WriteLine("CMYK({0},{1},{2},{3})\t\t=> RGB({4},{5},{6})", c, m, y, k, rgbColor.R, rgbColor.G, rgbColor.B);
}
//The output looks like this:
//Convert CMYK to RGB without using ICC profiles.
//CMYK(255,0,0,0) => RGB(0,255,255)
//CMYK(0,255,0,0) => RGB(255,0,255)
//CMYK(0,0,255,0) => RGB(255,255,0)
//CMYK(0,0,0,255) => RGB(0,0,0)
ToArgb32(int[])
La conversione da colori CMYK a colori ARGB.
public static int[] ToArgb32(int[] cmykPixels)
Parameters
cmykPixels
int
[ ]
I colori CMYK sono presentati come valori integrali a 32 bit.
Returns
int [ ]
I colori ARGB sono presentati come valori integrali a 32 bit.
ToArgbIcc(int[])
La conversione da colori CMYK a colori ARGB utilizzando la conversione Icc con profili predefiniti.
public static Color[] ToArgbIcc(int[] cmykPixels)
Parameters
cmykPixels
int
[ ]
I pixel CMYK sono presentati come valori integrali a 32 bit.
Returns
Color [ ]
I colori ARGB.
ToArgbIcc(int[ ], di Stream, Stream)
La conversione da colori CMYK a colori ARGB utilizzando la conversione Icc con profili personalizzati.
public static Color[] ToArgbIcc(int[] cmykPixels, Stream cmykIccStream, Stream rgbIccStream)
Parameters
cmykPixels
int
[ ]
I colori CMYK sono presentati come valori integrali a 32 bit.
cmykIccStream
Stream
Il flusso contenente il profilo CMYK Icc.
rgbIccStream
Stream
Il flusso contenente il profilo RGB Icc.
Returns
Color [ ]
I colori ARGB.
ToArgbIcc(int)
La conversione da colore CMYK a colore ARGB utilizzando la conversione Icc con profili predefiniti.
public static Color ToArgbIcc(int cmykPixel)
Parameters
cmykPixel
int
Il colore CMYK è presentato come un valore integrale di 32 bit.
Returns
Il colore ARGB.
Examples
L’esempio seguente mostra come convertire i colori CMYK ai loro colleghi RGB utilizzando i profili ICC.
int[] cmykColors = new int[]
{
Aspose.Imaging.CmykColorHelper.FromComponents(255, 0, 0, 0), // Cyan
Aspose.Imaging.CmykColorHelper.FromComponents(0, 255, 0, 0), // Magenta
Aspose.Imaging.CmykColorHelper.FromComponents(0, 0, 255, 0), // Yellow
Aspose.Imaging.CmykColorHelper.FromComponents(0, 0, 0, 255), // Black
};
System.Console.WriteLine("Convert CMYK to RGB using default ICC profiles.");
foreach (int cmykColor in cmykColors)
{
Aspose.Imaging.Color rgbColor = Aspose.Imaging.CmykColorHelper.ToArgbIcc(cmykColor);
int c = Aspose.Imaging.CmykColorHelper.GetC(cmykColor);
int m = Aspose.Imaging.CmykColorHelper.GetM(cmykColor);
int y = Aspose.Imaging.CmykColorHelper.GetY(cmykColor);
int k = Aspose.Imaging.CmykColorHelper.GetK(cmykColor);
System.Console.WriteLine("CMYK({0},{1},{2},{3})\t\t=> RGB({4},{5},{6})", c, m, y, k, rgbColor.R, rgbColor.G, rgbColor.B);
}
// Specify your path to custom RGB and CMYK ICC profiles.
string dir = "c:\\temp\\iccprofiles\\";
System.Console.WriteLine("Convert CMYK to RGB using custom ICC profiles.");
using (System.IO.Stream rgbProfileStream = System.IO.File.OpenRead(dir + "eciRGB_v2.icc"))
using (System.IO.Stream cmykProfileStream = System.IO.File.OpenRead(dir + "ISOcoated_v2_FullGamut4.icc"))
{
foreach (int cmykColor in cmykColors)
{
Aspose.Imaging.Color rgbColor = Aspose.Imaging.CmykColorHelper.ToArgbIcc(cmykColor);
int c = Aspose.Imaging.CmykColorHelper.GetC(cmykColor);
int m = Aspose.Imaging.CmykColorHelper.GetM(cmykColor);
int y = Aspose.Imaging.CmykColorHelper.GetY(cmykColor);
int k = Aspose.Imaging.CmykColorHelper.GetK(cmykColor);
System.Console.WriteLine("CMYK({0},{1},{2},{3})\t\t=> RGB({4},{5},{6})", c, m, y, k, rgbColor.R, rgbColor.G, rgbColor.B);
}
}
//The output looks like this:
//Convert CMYK to RGB using default ICC profiles.
//CMYK(255,0,0,0) => RGB(46,188,220)
//CMYK(0,255,0,0) => RGB(231,52,142)
//CMYK(0,0,255,0) => RGB(244,253,63)
//CMYK(0,0,0,255) => RGB(21,21,21)
//Convert CMYK to RGB using custom ICC profiles.
//CMYK(255,0,0,0) => RGB(46,188,220)
//CMYK(0,255,0,0) => RGB(231,52,142)
//(0,0,255,0) => RGB(244,253,63)
//CMYK(0,0,0,255) => RGB(21,21,21)
ToArgbIcc(Il flusso, il flusso)
La conversione da colore CMYK a colore ARGB utilizzando la conversione Icc con profilo personalizzato.
public static Color ToArgbIcc(int cmykPixel, Stream cmykIccStream, Stream rgbIccStream)
Parameters
cmykPixel
int
Il colore CMYK è presentato come un valore integrale di 32 bit.
cmykIccStream
Stream
Il flusso contenente il profilo CMYK Icc.
rgbIccStream
Stream
Il flusso contenente il profilo RGB Icc.
Returns
Il colore ARGB.
Examples
L’esempio seguente mostra come convertire i colori CMYK ai loro colleghi RGB utilizzando i profili ICC.
int[] cmykColors = new int[]
{
Aspose.Imaging.CmykColorHelper.FromComponents(255, 0, 0, 0), // Cyan
Aspose.Imaging.CmykColorHelper.FromComponents(0, 255, 0, 0), // Magenta
Aspose.Imaging.CmykColorHelper.FromComponents(0, 0, 255, 0), // Yellow
Aspose.Imaging.CmykColorHelper.FromComponents(0, 0, 0, 255), // Black
};
System.Console.WriteLine("Convert CMYK to RGB using default ICC profiles.");
foreach (int cmykColor in cmykColors)
{
Aspose.Imaging.Color rgbColor = Aspose.Imaging.CmykColorHelper.ToArgbIcc(cmykColor);
int c = Aspose.Imaging.CmykColorHelper.GetC(cmykColor);
int m = Aspose.Imaging.CmykColorHelper.GetM(cmykColor);
int y = Aspose.Imaging.CmykColorHelper.GetY(cmykColor);
int k = Aspose.Imaging.CmykColorHelper.GetK(cmykColor);
System.Console.WriteLine("CMYK({0},{1},{2},{3})\t\t=> RGB({4},{5},{6})", c, m, y, k, rgbColor.R, rgbColor.G, rgbColor.B);
}
// Specify your path to custom RGB and CMYK ICC profiles.
string dir = "c:\\temp\\iccprofiles\\";
System.Console.WriteLine("Convert CMYK to RGB using custom ICC profiles.");
using (System.IO.Stream rgbProfileStream = System.IO.File.OpenRead(dir + "eciRGB_v2.icc"))
using (System.IO.Stream cmykProfileStream = System.IO.File.OpenRead(dir + "ISOcoated_v2_FullGamut4.icc"))
{
foreach (int cmykColor in cmykColors)
{
Aspose.Imaging.Color rgbColor = Aspose.Imaging.CmykColorHelper.ToArgbIcc(cmykColor);
int c = Aspose.Imaging.CmykColorHelper.GetC(cmykColor);
int m = Aspose.Imaging.CmykColorHelper.GetM(cmykColor);
int y = Aspose.Imaging.CmykColorHelper.GetY(cmykColor);
int k = Aspose.Imaging.CmykColorHelper.GetK(cmykColor);
System.Console.WriteLine("CMYK({0},{1},{2},{3})\t\t=> RGB({4},{5},{6})", c, m, y, k, rgbColor.R, rgbColor.G, rgbColor.B);
}
}
//The output looks like this:
//Convert CMYK to RGB using default ICC profiles.
//CMYK(255,0,0,0) => RGB(46,188,220)
//CMYK(0,255,0,0) => RGB(231,52,142)
//CMYK(0,0,255,0) => RGB(244,253,63)
//CMYK(0,0,0,255) => RGB(21,21,21)
//Convert CMYK to RGB using custom ICC profiles.
//CMYK(255,0,0,0) => RGB(46,188,220)
//CMYK(0,255,0,0) => RGB(231,52,142)
//(0,0,255,0) => RGB(244,253,63)
//CMYK(0,0,0,255) => RGB(21,21,21)
ToCmyk(int[])
La conversione da colori ARGB a colori CMYK.
public static int[] ToCmyk(int[] argbPixels)
Parameters
argbPixels
int
[ ]
I colori ARGB sono presentati come valori integrali a 32 bit.
Returns
int [ ]
I colori CMYK sono presentati come valori integrali a 32 bit.
ToCmyk(int)
La conversione da colore ARGB a colore CMYK.
public static int ToCmyk(int argbPixel)
Parameters
argbPixel
int
Il colore ARGB è presentato come un valore integrale di 32 bit.
Returns
Il colore CMYK è presentato come un valore integrale di 32 bit.
ToCmyk(Color)
La conversione da colore ARGB a colore CMYK.
public static int ToCmyk(Color pixel)
Parameters
pixel
Color
Il colore ARGB.
Returns
Il colore CMYK è presentato come un valore integrale di 32 bit.
Examples
L’esempio seguente riempie l’area centrale di un’immagine di raster con pixel neri utilizzando il metodo Aspose.Imaging.RasterImage.SaveCmyk32Pixels.
string dir = @"c:\temp\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
{
Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;
// Get an integer representation of black in the CMYK color space.
int blackCmyk = Aspose.Imaging.CmykColorHelper.ToCmyk(Color.Black);
// The black square.
int[] pixels = new int[(rasterImage.Width / 2) * (rasterImage.Height / 2)];
for (int i = 0; i < pixels.Length; i++)
{
pixels[i] = blackCmyk;
}
// Draw the black square at the center of the image.
Aspose.Imaging.Rectangle area = new Aspose.Imaging.Rectangle(rasterImage.Width / 4, rasterImage.Height / 4, rasterImage.Width / 2, rasterImage.Height / 2);
rasterImage.SaveCmyk32Pixels(area, pixels);
rasterImage.Save(dir + "sample.SaveCmyk32Pixels.png");
}
L’esempio seguente mostra come convertire i colori RGB ai loro colleghi CMYK senza applicare i profili ICC.
Aspose.Imaging.Color[] rgbColors = new Aspose.Imaging.Color[]
{
Aspose.Imaging.Color.Red,
Aspose.Imaging.Color.Green,
Aspose.Imaging.Color.Blue,
};
System.Console.WriteLine("Convert RGB to CMYK without using ICC profiles.");
foreach (Aspose.Imaging.Color rgbColor in rgbColors)
{
int cmyk = Aspose.Imaging.CmykColorHelper.ToCmyk(rgbColor);
int c = Aspose.Imaging.CmykColorHelper.GetC(cmyk);
int m = Aspose.Imaging.CmykColorHelper.GetM(cmyk);
int y = Aspose.Imaging.CmykColorHelper.GetY(cmyk);
int k = Aspose.Imaging.CmykColorHelper.GetK(cmyk);
System.Console.WriteLine("RGB({0},{1},{2})\t\t=> CMYK({3},{4},{5},{6})", rgbColor.R, rgbColor.G, rgbColor.B, c, m, y, k);
}
//The output looks like this:
//Convert RGB to CMYK without using ICC profiles.
//RGB(255,0,0) => CMYK(0,255,255,0)
//RGB(0,128,0) => CMYK(255,0,255,127)
//RGB(0,0,255) => CMYK(255,255,0,0)
ToCmyk(Color[])
La conversione da colori ARGB a colori CMYK.
public static int[] ToCmyk(Color[] pixels)
Parameters
pixels
Color
[ ]
I colori ARGB.
Returns
int [ ]
I colori CMYK sono presentati come valori integrali a 32 bit.
ToCmykBytes(int[ ], di int, int)
Convertire ARGB in CMYK.
public static byte[] ToCmykBytes(int[] argbPixels, int startIndex, int length)
Parameters
argbPixels
int
[ ]
I colori RGB presentati come valori integrali a 32 bit.
startIndex
int
Indice di partenza del colore RGB.
length
int
Il numero di pixel RGB da convertire.
Returns
byte [ ]
I colori CMYK presentati come aria byte.
ToCmykIcc(Color[ ], di Stream, Stream)
La conversione da colori ARGB a colori CMYK utilizzando la conversione Icc con profili personalizzati.
public static int[] ToCmykIcc(Color[] pixels, Stream rgbIccStream, Stream cmykIccStream)
Parameters
pixels
Color
[ ]
I colori ARGB.
rgbIccStream
Stream
Il flusso contenente il profilo RGB Icc.
cmykIccStream
Stream
Il flusso contenente il profilo CMYK Icc.
Returns
int [ ]
I colori CMYK sono presentati come valori integrali a 32 bit.
ToCmykIcc(int[ ], di Stream, Stream)
La conversione da colori ARGB a colori CMYK utilizzando la conversione Icc con profili personalizzati.
public static int[] ToCmykIcc(int[] pixels, Stream rgbIccStream, Stream cmykIccStream)
Parameters
pixels
int
[ ]
I colori ARGB.
rgbIccStream
Stream
Il flusso contenente il profilo RGB Icc.
cmykIccStream
Stream
Il flusso contenente il profilo CMYK Icc.
Returns
int [ ]
I colori CMYK sono presentati come valori integrali a 32 bit.
ToCmykIcc(Color[])
La conversione da colori ARGB a colori CMYK utilizzando la conversione Icc con profili predefiniti.
public static int[] ToCmykIcc(Color[] pixels)
Parameters
pixels
Color
[ ]
I colori ARGB.
Returns
int [ ]
I colori CMYK sono presentati come valori integrali a 32 bit.
ToCmykIcc(int[])
La conversione da colori ARGB a colori CMYK utilizzando la conversione Icc con profili predefiniti.
public static int[] ToCmykIcc(int[] pixels)
Parameters
pixels
int
[ ]
I colori ARGB.
Returns
int [ ]
I colori CMYK sono presentati come valori integrali a 32 bit.
ToCmykIcc(Color)
La conversione da colore ARGB a colore CMYK utilizzando la conversione Icc con profili predefiniti.
public static int ToCmykIcc(Color pixel)
Parameters
pixel
Color
Il colore ARGB.
Returns
Il colore CMYK è presentato come un valore integrale di 32 bit.
Examples
L’esempio seguente mostra come convertire i colori RGB ai loro colleghi CMYK utilizzando i profili ICC.
Aspose.Imaging.Color[] rgbColors = new Aspose.Imaging.Color[]
{
Aspose.Imaging.Color.Red,
Aspose.Imaging.Color.Green,
Aspose.Imaging.Color.Blue,
};
System.Console.WriteLine("Convert RGB to CMYK using default ICC profiles.");
foreach (Aspose.Imaging.Color rgbColor in rgbColors)
{
int cmyk = Aspose.Imaging.CmykColorHelper.ToCmykIcc(rgbColor);
int c = Aspose.Imaging.CmykColorHelper.GetC(cmyk);
int m = Aspose.Imaging.CmykColorHelper.GetM(cmyk);
int y = Aspose.Imaging.CmykColorHelper.GetY(cmyk);
int k = Aspose.Imaging.CmykColorHelper.GetK(cmyk);
System.Console.WriteLine("RGB({0},{1},{2})\t\t=> CMYK({3},{4},{5},{6})", rgbColor.R, rgbColor.G, rgbColor.B, c, m, y, k);
}
// Specify your path to the RGB and CMYK ICC profiles.
string dir = "c:\\temp\\iccprofiles\\";
System.Console.WriteLine("Convert RGB to CMYK using custom ICC profiles.");
using (System.IO.Stream rgbProfileStream = System.IO.File.OpenRead(dir + "eciRGB_v2.icc"))
using (System.IO.Stream cmykProfileStream = System.IO.File.OpenRead(dir + "ISOcoated_v2_FullGamut4.icc"))
{
foreach (Aspose.Imaging.Color rgbColor in rgbColors)
{
int cmyk = Aspose.Imaging.CmykColorHelper.ToCmykIcc(rgbColor, rgbProfileStream, cmykProfileStream);
int c = Aspose.Imaging.CmykColorHelper.GetC(cmyk);
int m = Aspose.Imaging.CmykColorHelper.GetM(cmyk);
int y = Aspose.Imaging.CmykColorHelper.GetY(cmyk);
int k = Aspose.Imaging.CmykColorHelper.GetK(cmyk);
System.Console.WriteLine("RGB({0},{1},{2})\t\t=> CMYK({3},{4},{5},{6})", rgbColor.R, rgbColor.G, rgbColor.B, c, m, y, k);
}
}
//The output looks like this:
//Convert RGB to CMYK using default ICC profiles.
//RGB(255,0,0) => CMYK(0,254,249,15)
//RGB(0,128,0) => CMYK(247,21,254,85)
//RGB(0,0,255) => CMYK(254,195,0,134)
//Convert RGB to CMYK using custom ICC profiles.
//RGB(255,0,0) => CMYK(0,207,219,0)
//RGB(0,128,0) => CMYK(238,16,254,80)
//RGB(0,0,255) => CMYK(242,182,0,0)
ToCmykIcc(int)
La conversione da colore ARGB a colore CMYK utilizzando la conversione Icc con profili predefiniti.
public static int ToCmykIcc(int argb)
Parameters
argb
int
Il colore ARGB.
Returns
Il colore CMYK è presentato come un valore integrale di 32 bit.
ToCmykIcc(Colore, flusso e flusso)
La conversione da colore ARGB a colore CMYK utilizzando la conversione Icc con profili personalizzati.
public static int ToCmykIcc(Color pixel, Stream rgbIccStream, Stream cmykIccStream)
Parameters
pixel
Color
Il colore ARGB.
rgbIccStream
Stream
Il flusso contenente il profilo RGB Icc.
cmykIccStream
Stream
Il flusso contenente il profilo CMYK Icc.
Returns
Il colore CMYK è presentato come un valore integrale di 32 bit.
Examples
L’esempio seguente mostra come convertire i colori RGB ai loro colleghi CMYK utilizzando i profili ICC.
Aspose.Imaging.Color[] rgbColors = new Aspose.Imaging.Color[]
{
Aspose.Imaging.Color.Red,
Aspose.Imaging.Color.Green,
Aspose.Imaging.Color.Blue,
};
System.Console.WriteLine("Convert RGB to CMYK using default ICC profiles.");
foreach (Aspose.Imaging.Color rgbColor in rgbColors)
{
int cmyk = Aspose.Imaging.CmykColorHelper.ToCmykIcc(rgbColor);
int c = Aspose.Imaging.CmykColorHelper.GetC(cmyk);
int m = Aspose.Imaging.CmykColorHelper.GetM(cmyk);
int y = Aspose.Imaging.CmykColorHelper.GetY(cmyk);
int k = Aspose.Imaging.CmykColorHelper.GetK(cmyk);
System.Console.WriteLine("RGB({0},{1},{2})\t\t=> CMYK({3},{4},{5},{6})", rgbColor.R, rgbColor.G, rgbColor.B, c, m, y, k);
}
// Specify your path to the RGB and CMYK ICC profiles.
string dir = "c:\\temp\\iccprofiles\\";
System.Console.WriteLine("Convert RGB to CMYK using custom ICC profiles.");
using (System.IO.Stream rgbProfileStream = System.IO.File.OpenRead(dir + "eciRGB_v2.icc"))
using (System.IO.Stream cmykProfileStream = System.IO.File.OpenRead(dir + "ISOcoated_v2_FullGamut4.icc"))
{
foreach (Aspose.Imaging.Color rgbColor in rgbColors)
{
int cmyk = Aspose.Imaging.CmykColorHelper.ToCmykIcc(rgbColor, rgbProfileStream, cmykProfileStream);
int c = Aspose.Imaging.CmykColorHelper.GetC(cmyk);
int m = Aspose.Imaging.CmykColorHelper.GetM(cmyk);
int y = Aspose.Imaging.CmykColorHelper.GetY(cmyk);
int k = Aspose.Imaging.CmykColorHelper.GetK(cmyk);
System.Console.WriteLine("RGB({0},{1},{2})\t\t=> CMYK({3},{4},{5},{6})", rgbColor.R, rgbColor.G, rgbColor.B, c, m, y, k);
}
}
//The output looks like this:
//Convert RGB to CMYK using default ICC profiles.
//RGB(255,0,0) => CMYK(0,254,249,15)
//RGB(0,128,0) => CMYK(247,21,254,85)
//RGB(0,0,255) => CMYK(254,195,0,134)
//Convert RGB to CMYK using custom ICC profiles.
//RGB(255,0,0) => CMYK(0,207,219,0)
//RGB(0,128,0) => CMYK(238,16,254,80)
//RGB(0,0,255) => CMYK(242,182,0,0)
ToCmykIcc(Il flusso, il flusso)
La conversione da colore ARGB a colore CMYK utilizzando la conversione Icc con profili personalizzati.
public static int ToCmykIcc(int argb, Stream rgbIccStream, Stream cmykIccStream)
Parameters
argb
int
Il colore ARGB.
rgbIccStream
Stream
Il flusso contenente il profilo RGB Icc.
cmykIccStream
Stream
Il flusso contenente il profilo CMYK Icc.
Returns
Il colore CMYK è presentato come un valore integrale di 32 bit.
ToCmykIccBytes(int[ ], int , int , Stream , Stream)
Convertire RGB a CMYK utilizzando profili ICC personalizzati.
public static byte[] ToCmykIccBytes(int[] pixels, int startIndex, int length, Stream rgbIccStream, Stream cmykIccStream)
Parameters
pixels
int
[ ]
I colori RGB presentati come valori integrali a 32 bit.
startIndex
int
Indice di partenza del colore RGB.
length
int
Il numero di pixel RGB da convertire.
rgbIccStream
Stream
Il profilo RGB.
cmykIccStream
Stream
Il profilo CMYK.
Returns
byte [ ]
I colori CMYK presentati come aria byte.
ToCmykaBytes(int[ ], di int, int)
Convertire ARGB in CMYKA (con trasparenza).
public static byte[] ToCmykaBytes(int[] argbPixels, int startIndex, int length)
Parameters
argbPixels
int
[ ]
I colori RGB presentati come valori integrali a 32 bit.
startIndex
int
Indice di partenza del colore RGB.
length
int
Il numero di pixel RGB da convertire.
Returns
byte [ ]
I colori CMYK presentati come aria byte.
ToCmykaIccBytes(int[ ], int , int , Stream , Stream)
Converti RGB a CMYKA (con alfa) utilizzando profili ICC personalizzati.
public static byte[] ToCmykaIccBytes(int[] pixels, int startIndex, int length, Stream rgbIccStream, Stream cmykIccStream)
Parameters
pixels
int
[ ]
I colori RGB presentati come valori integrali a 32 bit.
startIndex
int
Indice di partenza del colore RGB.
length
int
Il numero di pixel RGB da convertire.
rgbIccStream
Stream
Il profilo RGB.
cmykIccStream
Stream
Il profilo CMYK.
Returns
byte [ ]
I colori CMYK presentati come aria byte.
ToPsdCmykIcc(int[ ], di Stream, Stream)
La conversione da colori ARGB a colori CMYK utilizzando la conversione Icc con profili personalizzati.Utilizza il formato PSD CMYK con ordine di byte KCMY con valori di canale inversati.
public static int[] ToPsdCmykIcc(int[] pixels, Stream rgbIccStream, Stream cmykIccStream)
Parameters
pixels
int
[ ]
I colori ARGB.
rgbIccStream
Stream
Il flusso contenente il profilo RGB Icc.
cmykIccStream
Stream
Il flusso contenente il profilo CMYK Icc.
Returns
int [ ]
I colori CMYK presentati come valori integrali a 32 bit nell’ordine byte KCMY con valori canali inversati.
ToPsdCmykIcc(int[])
La conversione da colori ARGB a colori CMYK utilizzando la conversione Icc con profili predefiniti.Utilizza il formato PSD CMYK con ordine di byte KCMY con valori di canale inversati.
public static int[] ToPsdCmykIcc(int[] pixels)
Parameters
pixels
int
[ ]
I colori ARGB.
Returns
int [ ]
I colori CMYK presentati come valori integrali a 32 bit nell’ordine byte KCMY con valori canali inversati.
ToPsdCmykIcc(int)
La conversione da colore ARGB a colore CMYK utilizzando la conversione Icc con profili predefiniti.Utilizza il formato PSD CMYK con ordine di byte KCMY con valori di canale inversati.
public static int ToPsdCmykIcc(int argb)
Parameters
argb
int
Il colore ARGB.
Returns
Il colore CMYK presentato come un valore integrale di 32 bit nell’ordine byte KCMY con valori canali inversati.
ToPsdCmykIcc(Il flusso, il flusso)
La conversione da colore ARGB a colore CMYK utilizzando la conversione Icc con profili personalizzati.
public static int ToPsdCmykIcc(int pixel, Stream rgbIccStream, Stream cmykIccStream)
Parameters
pixel
int
Il colore ARGB.
rgbIccStream
Stream
Il flusso contenente il profilo RGB Icc.
cmykIccStream
Stream
Il flusso contenente il profilo CMYK Icc.
Returns
I colori CMYK presentati come valori integrali a 32 bit nell’ordine byte KCMY con valori canali inversati.