While we appreciate comments from our users, please follow our posting guidelines. Have you tried the Cyotek Forums for support from Cyotek and the community?

Styling with Markdown is supported

Original Comment

Gravatar

ali

# Reply

Hi Richard, first of all thanks for your great job on imagebox. I have learned lot on implementing my own image box based on your tutorials and source codes. I have a question and i hope you could help me with. I am loading binary files as 1bpp bitmap into imagebox. and i have no problem with little ones. I read a byte array and convert it to bitmap like this: Bitmap bmp = new Bitmap(width, height, PixelFormat.Format1bppIndexed); BitmapData bmpData = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.WriteOnly, bmp.PixelFormat); Marshal.Copy(data, 0, bmpData.Scan0, data.Length); but when it comes to large files my problem begins. I want to deal with files in size of more than 10gb. obviously i can't load all of the file at once in to the memory, and i have to load part of the file that it need to be display on the imagebox. I want to know is there a tool/way to ease my problem?

Gravatar

Richard Moss

# Reply

Ali,

Thanks for the comment, glad you enjoyed the control. That sounds like an impressively large image file! I actually got asked something similar recently, and while I don't have a solution for either question, I have an idea for yours. Assuming the bitmap isn't run length encoded, you could read the bitmap header to get the dimensions from which you could use to set up a virtual mode ImageBox. When it's time to paint the box, you could then calculate the bits of the file you need to read, pull the data out, and build a small bitmap of that particular "view" to display. This is at least feasible, but probably really complicated to do. At least it's possible though as no compression is involved so you can directly grab the bytes from the file and split out the bits representing the pixels.

Sorry I can't be more specific, but this isn't something I've needed to do before so while I have a guess, I don't have a concrete solution. I haven't tried working with 1bpp pixel images so I'm not sure how the data is stored in each byte - but there's probably multiple pixels in each one.

Regards;
Richard Moss