PIL saving corrupted images
Luciano Mollea <[email protected]> Sun, 3 Mar 2013 12:06:39 +0000 (GMT)
| Newsgroups | gmane.comp.python.image |
|---|---|
| Message-ID | <[email protected]> |
--===============2027690568== Content-Type: multipart/alternative; boundary="-1236089829-1405559717-1362312399=:35628" ---1236089829-1405559717-1362312399=:35628 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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.=0AThe image I have = is a 30+MB BMP image (24 bit) about 3000x2500 sized.=0AThe mapping js libra= ry i'm using (leaflet) wants a "tile server" with tiles of 256x256 and an a= ppropriate naming scheme=0ASo I used PIL to write a simple python script to= create those tiles, cropping pieces from the original image.=0AIf I save t= he tiles to BMP files, everything's fine. If I save them to PNG or JPEG the= y are corrupted.=0A=0APNG files complaint that they are invalid files (usin= g pngcheck it tells that the "image may have undergone a unix-dos conversio= n").=0AIf I use JPG conversion, images are corrupted (I see images as a bun= ch of 8x8 blocks with just noise instead of the expected image slice).=0A= =0AI'm using PIL on Python 2.6.6 on windows 7 64 bit.=0A=0A(mind, I used PI= L for another image manipulation script on the same machine and that script= works fine)=0A=0AAny hint about what could be wrong?=0A=0ATHanks=0A=0ALM ---1236089829-1405559717-1362312399=:35628 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable <html><body><div style=3D"color:#000; background-color:#fff; font-family:ti= mes new roman, new york, times, serif;font-size:12pt"><div>I am trying to s= plit an image into a number of same-sized chunks to use it as a base for a = "Map Tile"/"Map Layer" web application.</div><div>The image I have is a 30+= MB BMP image (24 bit) about 3000x2500 sized.</div><div>The mapping js libra= ry i'm using (leaflet) wants a "tile server" with tiles of 256x256 and an a= ppropriate naming scheme</div><div>So I used PIL to write a simple python s= cript to create those tiles, cropping pieces from the original image.</div>= <div>If I save the tiles to BMP files, everything's fine. If I save them to= PNG or JPEG they are corrupted.</div><div><br></div><div style=3D"color: r= gb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', t= imes, serif; background-color: transparent; font-style: normal;">PNG files = complaint that they are invalid files (using pngcheck it tells that the "image may have undergone a unix-dos conversion").</div><div style=3D"colo= r: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york= ', times, serif; background-color: transparent; font-style: normal;">If I u= se JPG conversion, images are corrupted (I see images as a bunch of 8x8 blo= cks with just noise instead of the expected image slice).</div><div style= =3D"color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', '= new york', times, serif; background-color: transparent; font-style: normal;= "><br></div><div style=3D"color: rgb(0, 0, 0); font-size: 16px; font-family= : 'times new roman', 'new york', times, serif; background-color: transparen= t; font-style: normal;">I'm using PIL on Python 2.6.6 on windows 7 64 bit.<= /div><div style=3D"color: rgb(0, 0, 0); font-size: 16px; font-family: 'time= s new roman', 'new york', times, serif; background-color: transparent; font= -style: normal;"><br></div><div style=3D"color: rgb(0, 0, 0); font-size: 16= px; font-family: 'times new roman', 'new york', times, serif; background-color= : transparent; font-style: normal;">(mind, I used PIL for another image man= ipulation script on the same machine and that script works fine)</div><div = style=3D"color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roma= n', 'new york', times, serif; background-color: transparent; font-style: no= rmal;"><br></div><div style=3D"color: rgb(0, 0, 0); font-size: 16px; font-f= amily: 'times new roman', 'new york', times, serif; background-color: trans= parent; font-style: normal;">Any hint about what could be wrong?</div><div = style=3D"color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roma= n', 'new york', times, serif; background-color: transparent; font-style: no= rmal;"><br></div><div style=3D"color: rgb(0, 0, 0); font-size: 16px; font-f= amily: 'times new roman', 'new york', times, serif; background-color: trans= parent; font-style: normal;">THanks</div><div style=3D"color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif;= background-color: transparent; font-style: normal;"><br></div><div style= =3D"color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', '= new york', times, serif; background-color: transparent; font-style: normal;= ">LM</div></div></body></html> ---1236089829-1405559717-1362312399=:35628-- --===============2027690568== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Image-SIG maillist - [email protected] http://mail.python.org/mailman/listinfo/image-sig --===============2027690568==--