[Image-SIG] PIL saving corrupted images

Luciano Mollea lmollea at yahoo.it
Sun Mar 3 13:06:41 CET 2013


I am trying to split an image into a number of same-sized chunks to use it as a base for a "Map Tile"/"Map Layer" web application.
The image I have is a 30+MB BMP image (24 bit) about 3000x2500 sized.
The mapping js library i'm using (leaflet) wants a "tile server" with tiles of 256x256 and an appropriate naming scheme
So I used PIL to write a simple python script to create those tiles, cropping pieces from the original image.
If I save the tiles to BMP files, everything's fine. If I save them to PNG or JPEG they are corrupted.

PNG files complaint that they are invalid files (using pngcheck it tells that the "image may have undergone a unix-dos conversion").
If I use JPG conversion, images are corrupted (I see images as a bunch of 8x8 blocks with just noise instead of the expected image slice).

I'm using PIL on Python 2.6.6 on windows 7 64 bit.

(mind, I used PIL for another image manipulation script on the same machine and that script works fine)

Any hint about what could be wrong?

THanks

LM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/image-sig/attachments/20130303/483efc01/attachment-0001.html>


More information about the Image-SIG mailing list