How to load cmyk image with c++ or c# and to change cmyk values of every pixel?
For a whole month I've been trying to find out how to load a cmyk image (8-bit tiff) and do a UCA, UCR, GCR transformations.
I know the formulas for this transformations, but I have a problem to load an cmyk image with C++ or C#.
My plan is to manipulate the image pixel by pixel and change every value C, M, Y, K of that pixel, and finally save changed image as 8-bit tiff cmyk image. So basically I want to run through each pixel, make change to cmyk values, and save the image.
I have difficulties to find and install such a library for C# or C++, and I开发者_StackOverflow社区'm using Visual Studio Express 2010 for both.
What libraries can I use to load these images?
libtiff will let you manipulate TIFF files. See also this answer on building libtiff using Visual Studio.
You'll need to read the image row by row using TIFFReadScanline
to avoid conversion to RGB by the library. The open source tifftopnm
utility does this; its source is here - it uses pick_cmyk_pixel
to convert the data to RGB after obtaining it, but naturally you can just substitute your own logic instead.
EMGU is a c# wrapper for opencv (c++) either of these will allow Tiff files to be easily used and manipulated. They will allow you to access pixels more readily and uses highly optimised code. Since these are a dedicated image processing libraries they will allow you to do more with your image without having to worry about RGB conversion or reading the file in etc.
Hope they help,
Cheers Chris
精彩评论