LittleCMS2.6 API.pdf page 83 states : void cmsDoTransform(cmsHTRANSFORM hTransform, const void * InputBuffer, void * OutputBuffer, cmsUInt32Number Size);
hTransform: Handle to a color transform object. InputBuffer: A pointer to the input bitmap OutputBuffer: A pointer to the output bitmap. Size: the number of PIXELS to be transformed. First Example ---------------------------------------------------------------------------- -------------------- RGB Image is 4 pixels wide by 4 pixels high (3 bytes/pixels). Do I encode 16 pixels x 3 bytes/pixels = 48 as Size? The size of the byte array is 48, yes, but there are only 16 pixels to process : Byte[] Input = new byte[48]; Byte[] Output = new byte[48]; UInt32 pixels = 16; cmsDoTransform(xform, Input, Output, pixels); OK, this works. Second Example ---------------------------------------------------------------------------- -------------------- RGB Image is 512 pixels wide by 512 pixels high (3 bytes/pixels). Do I encode 262144 pixels x 3 bytes/pixels = 786432 as Size? The size of the byte array is 786432, no choice, but there are only 262144 pixels to process : Byte[] Input = new byte[786432]; Byte[] Output = new byte[786432]; UInt32 pixels = 262144; cmsDoTransform(xform, Input, Output, pixels); No, this does NOT work, MemoryAccessViolations? Oops!!! I think I understand what my error is : Input is RGB but Output is *CMYK* (in my code), so I need to allocate 4 bytes for each pixel on the output buffer!!!!! Byte[] Input = new byte[786432]; Byte[] Output = new byte[1048576]; UInt32 pixels = 262144; cmsDoTransform(xform, Input, Output, pixels); This is working!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Thank you Christian and Noel -- I owe you each 12 beers and a pizza, if ever you pass by Montreal ;-) Marti Maria, please consider add a small example in the future to the API documentation? // Roger ------------------------------ Message: 5 Date: Sun, 10 Jul 2016 09:15:36 +0200 From: Christian Schmitz <realbasicli...@monkeybreadsoftware.de> Subject: Re: [Lcms-user] Upper limit cmsDoTransform To: lcms-user@lists.sourceforge.net Message-ID: <f47ab09b-4203-474d-8c70-568a76245...@monkeybreadsoftware.de> Content-Type: text/plain; charset=us-ascii > Am 10.07.2016 um 02:18 schrieb Roger Breton <gr...@videotron.ca>: > > The following code works : > > Byte[] Input1 = new byte[6500]; > Byte[] Output1 = new byte[6500]; > UInt32 pixels = 6500; Are you sure it'S not 6500 * 4 bytes for 6500 pixels? Or * 3 for RGB? Sincerely Christian -- Read our blog about news on our plugins: http://www.mbsplugins.de/ ------------------------------------------------------------------------------ Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San Francisco, CA to explore cutting-edge tech and listen to tech luminaries present their vision of the future. This family event has something for everyone, including kids. Get more information and register today. http://sdm.link/attshape _______________________________________________ Lcms-user mailing list Lcms-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lcms-user