I have a 2208 x 3000 TransformedBitmap object with format {Indexed8} that I'm do .CopyPixels() on. I'm using
(int)((formattedBitmap.PixelWidth * formattedBitmap.Format.BitsPerPixel + 7) / 8)
(assuming 'formattedBitmap' is the name of the image from which I'm trying to copy the pixels) for the 'stride' value in my method call and an array of bytes which is 2208 in length. I have something just like this working elsewhere in the code (where the format of the image is {Gray8}. However, where I'm trying to do this same thing on the aforementioned image, I continually get an "Argument Out of Range" exception saying "The parameter value cannot be less than '6624000'.\r\nParameter name: buffer."
My questions about this are: why in the world does the exact same code seem to work in one place and not the other? What in the world, in layman's terms, really IS the 'stride'? And how can I get the desired affect (of copying the bits) without getting this error? What am I doing wrong?
Any help to this would be very much appreciated. Thanks a lot!