Click here to Skip to main content
15,888,006 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello everybody,

I am currently dealing with very large bitmaps (32bit, > 1GB) close to the bitmap size limit (~ 32 kpx squared). For file storage reasons, I would like to convert these bitmaps into more suitable formats, e.g. jpg or png. But I have to convert them without loading the whole bitmap into memory at once, since I will get a out-of-memory error.

Is there any way how to convert the bitmap in parts, e.g. linewise, blockwise or bandwise? At the moment, I am using Photoshop for saving, but this is not an option at a later stage of the project anymore.

Thanks for the help,
Max
Posted
Comments
Sergey Alexandrovich Kryukov 1-Dec-11 12:57pm    
I think you need to explain the whole scenario to have something to think about. One problem is: if you break the image into fragments and use lossy compression, it can create artifacts on the boundaries between fragments. If you experimented with Photoshop and find it fine, you can do exactly the same in your code. What's the problem then? The solution also depends on what library do you want to use: System.Drawing or WPF. Tag it: one or another, or both (which is an additional but solvable problem).
--SA

Now, you are using Photoshop. What is the environment at the later stage of your project (.NET or Java or C)?
 
Share this answer
 
Comments
mgulde 6-Dec-11 4:05am    
The environment in the later stage of the project will be .NET.
You might want to look into using the FreeImage library or the ImageMajik library. I'm pretty sure one or both of them can handle images that size (GDI+ is the reason you can't do it in native .Net).

Google is your friend.
 
Share this answer
 
Comments
mgulde 6-Dec-11 4:06am    
I already checked both of them and sadly, neither supports what I need. E.g. also the "convert" command in ImageMagick loads the whole image into memory before doing any more processing.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900