Click here to Skip to main content
16,020,626 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello all,

I am currently working on a c# open source photo mosaic software (Sourceforge Link). This software stitches together large amounts of small photos (tiles) into one big image.

Since the final image size is usually in the order of 20k px times 15k px, I am only saving a map of how to arrange the tiles in memory. To construct the final image, I am constructing it in parts, namely in band of 8 lines (can by any other number, too).

In the case of bmps, this data can then easily saved chunk by chunk by first writing a bmp header and subsequently appending the ARGB data to this file.

But the resulting bmps are far too big for further handling (e.g. giving them to some poster printing company). I would therefore like to save these big images as jpgs on my hdd.

The problem is now, that since jpgs are compressed, writing the data in chunks seems very tricky (the normal Bitmap.Save() function will load the full image into memory first and is therefore not applicable), since writing pure, uncompressed RGB data won't do it.

The basic functionality of writing jpgs in party should exist, since as far as I know the compression algorithm of jpg works with chunks or 8x8 px.

I looked into several image libraries (FreeImage, GraphicsMagick, LibTiff.NET) to find solutions for this problem, but could not find any. LibTiff basically has the desired functionality, but only for the tiff image format.

Thanks a lot for your help!
Max
Posted
Comments
Sergey Alexandrovich Kryukov 25-Nov-11 4:46am    
The problem is not really clear. To upload the order to a printing company, you will need one standard JPG anyway, because they hardly will accept the idea of using your software. Am I right? So, what the scenario when you save/load the chunks. Also, did you take into account, that for editing one needs to use only the lostless compression as periodic save of data in lossy compression degrades the image?
Does your compound image fit in memory at once (an a bitmap)? If not, how can it be printed by a printing company?
--SA
mgulde 25-Nov-11 5:38am    
Trying to convert this huge image into a standard jpg format is exactly what I am trying to do. I would like to have an "end product", the huge image, which is independent of the program, of course.

Well, the memory question is also a question of the machine, I guess. If you have a machine with lots of memory, you might only run into trouble once the .Net memory limit is hit (in the order of one GB, as far as I know). As far as I know the printer driver also only loads the image in parts for not getting into trouble with memory.

Thanks for yours thoughts!
Max

1 solution

 
Share this answer
 
Comments
mgulde 25-Nov-11 5:51am    
Thank you. About the articles:

1) Does only handle standard image functions.
2) It offers a lot of filters, but also fails to handle very large images - just tried it. AForge also does not seem to support this functionality.
3) Only covers standard bmp processing.

Thanks for your thoughts!
Max

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