Jump to content

laobrasuca

Newbies
  • Posts

    6
  • Joined

  • Last visited

Everything posted by laobrasuca

  1. hi eslwang, I don't use DIB section. As Rick says, you can use VirtualAlloc and pass the pointer to this BitMap constructor and it will be fine. However, as I said in the other topic, I can use this VirtualAlloc + Btmap combo to allocate it on RAM, but I can't save it to disk (the Bitmap.Save method crashes for >4GB, but I don't remember if 2GB is the limit). So I use the OpenCV lib now (with binds to C#). But if you don't need to save it to the disk, the VirtualAlloc + Bitmap combo will work just fine for >2GB. EDIT: yes, .Net has this 2GB limitation, even for 64bits system. VirtualAlloc is the usual way to overcome this issue. It's still part of Windows API, it's just that .Net don't have any class with direct access to it, so you need this importdll stuff. I hope that with this new WinRT on Windows 8, this 2GB limit will be treated properly.
  2. a little update here. I finally quit on using .Net. I'm using OpenCV to create and save image. Now I can save images as big as 2Gpixels or more. Sad but true.
  3. @Ego: I'd rather say that you're not in a good mood @riki: pretty nasty! I've just tested the save thing into a 24GB RAM machine. I can create the 24000 x 60000 image (blank image, it took me 17GB of RAM, which is roughly 3 times the space the image raw data should take). So, I hit the save button, chose filename (PNG file type) and chose 24bpp, then it takes a while to calculate the disk space it will take and finally start the file saving. At this moment I have a "There was an unspecified error while saving the file" error message box that shows up, which seems to come from the unhanded exception from Image.Save method (your SaveImage.Error.Exception). So I'll try to figure how to use System.Windows.Media.Imaging, as you suggest. But if you have any hints on how to use it, I would be glad to hear! in your face, Ego Hey, I'm just kidding Thx for your time guys, leo
  4. Hi Rick, thx for replying, I appreciate that. Thx for the tip! I've tried it both on .Net and C++ Gdiplus. I suceed on both, I can indeed create images 2Giga pixel or higher (also thx to you I could see how to overcome the famous 2GB arbitrary limit of .Net on array allocation). But now I have another problem... Even if I can generate the big image I can't save it to a file! When using Gdiplus::Status status = BigImage.Save(L"filename.png", &encoder, 0) I have status = Gdiplus::Status::Win32Error. And, when using BigImage.Save(L"filename.png") on .Net I have an unhanded exception of type 'System.Runtime.InteropServices.ExternalException' produced in System.Drawing.dll, and I can notice that it happens while the memory is not taken into RAM. Both failure happens when trying to save image of size 24000 x 60000 or larger, while for images with dimensions up to 24000 x 59000 it works just fine. I can't just figure what Win32Error means in this case (my disk has NTFS format and I have over 100GB of free space), and it surprises me that System.Drawing.Image.Save crashes like this (I tried BMP, PNG, TIFF, JPEG and GIF in both cases, all with the same result). I could not test your 3.5.8 version because I have not enough RAM memory to create a 24000x60000 image and save it (it creates the image, but takes all my 11GB of free space, then it takes a lot of time to save, so I had abort it). Tomorrow I'll try it on a 24GB RAM system. If you have any suggestions I would be happy to hear. yes, I've already done this a lot of times as I'm used to allocate over 4GB arrays. Ouch! Still, your code is pretty neat and elegantly written, I which I could produce such clean and well done code. Fortunately for me I don't need to do such complex things. My problem is that I have lots of data. I don't need to draw such huge images on controls. I actually have lots of 8192x8192 or 16384x16384 tile images (on disk) that I need to put together in a single image of > 1 gigapixels. That's why I need such huge bitmap. I've done it manually with PhotoShop, but it took all my RAM and 600GB of disk space with their temporary files, not to mention the time it took me to do it. Now I'm willing to do it automatically. thx, leo
  5. Hi Ego, I know about his decision, I read the post where he explains why. I'm not asking any support about old version, I'm not asking the source code of the newer. I'm only asking what does he do it for this very specifc part. As I understand, he doesn't release the source code anymore for right violation reasons, not because he doesn't want people know how things are done, afterall the Paint.Net project was open source (unless he has changed his mind in this regard). That's why I came here ask this question. I've being searching a lot in the net about how to do this, including Stakoverflow and MSDN forum, but no answer. Since this project has open source roots and have a forum, I though I could have some answers on this regard. Leo
  6. Hi there, first of all, congratulations for this very handy and superb tool, thx for sharing it! At this moment I'm trying creating very large images (over gigapixel) but everything I tested with winapi (including .Net System.Drawing.Bitmap, Gdipluss::Bitmap, CImage - which uses CreateDIBSection inside) can't get the work done (always getting invalid parameter error, not matter it the platform is x64 or not). When seeking for answers over the internet I read someone suggesting to download Paint.Net source code and check how it handles memory for large images. So installed the 3.5.8 version (the installation for 64 bits) to see if it would handle images like 24000 x 30000 and it is successful on handling such big files (my system is Win7 pro 64 bits with 12GB of RAM). I tried to find the source code, but as you explain in your site you no longer share the source code. However I could find an older version, 3.01, with copyrigths from 2007. But, in this version I could see that you throw an out of memory message box when trying creating image with 24000 x 30000 size. The default compilation platform is AnyCPU, so I've tried compiling the project for x64 platform to see if it would resolve the problem, but I got plenty of errors saying that the assemblies target a different processor than the application. That's why I came here to ask this question: can you share how you handle such big files in this new version, how you create image with this size? I could see what you use in the older version, I just wonder if you still use the same thing or you use another approach. Thx for your time, leo
×
×
  • Create New...