views:

38

answers:

0

Hi, I have to render a PDF into a very high resolution image (say up to and even over 100,000 * 80,000 pixels).

I managed to do that without going out of ram by splitting the render into several slices and then rendering each one using NSOperationQueue, basically drawing the NSImage pdf representation into a new NSImage using drawInRect:fromRect:operation:fraction: and then saving the TIFFRepresentation into file.

All is good and multicore and fast and I'm almost happy. Anyway I'd need to join those slices back again after I rendered them, to obtain a single TIFF file.

I would try to merge the files using NSInputStream and NSOutputStream but since each file is a complete tiff representation, merging together raw bytes would result in an unreadable picture file. Is there a way to merge image files together without fully loading them to ram, i.e. without using the NSImage methods?

Otherwise I could save raw pixel bytes instead of tiff representations and then join them with NSInputStream/NSOutputStream, but then how could I transform the whole bytes file into a recognizable TIFF without, again, loading the huge thing into ram?