merge two png pic

News123 news123 at free.fr
Wed Aug 5 03:44:18 EDT 2009


You didn't really tell us why you need one big file, which contains more
pixel, than you can probably store in RAM

Is it for printing?
Not knwoing your goal makes it difficult to suggest solutions.


Can't you use other image formats like raw RGB or
What other image formats are supported?
tiff? Raw? PPM ( http://en.wikipedia.org/wiki/Portable_pixmap )?

concatenating raw/ppm files with the same width would be really trivial.

so you could use python to create horizontal raw/ppm stripes.

then you could concatenate them without having to have the whole image
in RAM.


Perhaps there's even converters from ppm to png, that don't need the
whole image in RAM.



cocobear wrote:
> On Aug 4, 3:24 pm, News123 <news... at free.fr> wrote:
>> Hi,
>>
>>
>>
>>
>>
>> cocobear wrote:
>>>>>>> Map = Image.new("RGB", (x,y))
>>>>>>> Map.paste(im, box)
>>>>>>> Map.paste(im1,box)
>>>>>>> Map = Map.convert("L", optimize=True, palette=Image.ADAPTIVE)
>>>>>>> But if thetwopngpicis too big , or if I have tomergemorepic
>>>>>>> together, I will get MemoryError:
>>>>>>>>>>>>> Image.new("RGB",(44544,38656))
>>>> What do you want to do with such a big image? You will run into the same
>>>> limitation when you are trying to display it.
>>> I want to download a map from google map with high precision
>> For me it sounds strange to handle such big files.
>>
>> Is the map you download from Google really that big?
>> Mostly Google maps uses normally tiles of sizes 256x256 pixel, wich you
>> have to compose to get the  big image.
>>
> 
> The map I downloaded from Google is small(256x256). These small maps
> will compose a big image.
> 
> 
> 
>> If your problem is to combine tiles with different palettes, then you
>> should pobably look at a way to  'unify' the palette of all tiles befor
>> combining them.
>>
> 
> I think it is impossible to 'unify' all this tiles.
> 
> 
>> Being no expert of PIL I don't know whether this is easily possible though?
>>
>> bye
>>
>> N
> 



More information about the Python-list mailing list