What is the best way to anti-alias a very large resolution image in PIL

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

What is the best way to anti-alias a very large resolution image in PIL

Craig Coleman (C)
What is the best way to anti-alias a very large resolution image in PIL

Hi,

I have a really thorny problem.

I need to downsample a raster map that is 23622x23622 pixels to 7874x7874 pixels using the ANTIALIAS filter.

I have the following Python code:

>>> import Image
>>> img = Image.open(r"C:\temp\24bit_nd.tif")
>>> nimg = img.resize((7874,7874),Image.ANTIALIAS)

As soon as the resize method is called, python crashes instantly.  I presume this is a memory allocation issue.

Is there another way of performing anti-aliasing on such a large image (its 2.7GB uncompressed although I'm using LZW for storage).

I have tried converting the file to 8bit with a palette and this successfully downsamples but the ANTIALIAS is not performed.  What am I doing wrong?

Craig Coleman
Technical Lead
Information Systems, Ordnance Survey

L0F2, Adanac Drive, SOUTHAMPTON, United Kingdom, SO16 0AS
Phone: +44 (0) 2380 054641
www.ordnancesurvey.co.uk | [hidden email]
Please consider your environmental responsibility before printing this email.

This email is only intended for the person to whom it is addressed and may contain confidential information. If you have received this email in error, please notify the sender and delete this email which must not be copied, distributed or disclosed to any other person.

Unless stated otherwise, the contents of this email are personal to the writer and do not represent the official view of Ordnance Survey. Nor can any contract be formed on Ordnance Survey's behalf via email. We reserve the right to monitor emails and attachments without prior notice.

Thank you for your cooperation.

Ordnance Survey
Adanac Drive
Southampton SO16 0AS
Tel: 08456 050505
http://www.ordnancesurvey.co.uk


_______________________________________________
Image-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/image-sig
Reply | Threaded
Open this post in threaded view
|

Re: What is the best way to anti-alias a very large resolution image in PIL

Chris Mitchell-2
You can load parts of the image, resize+anti-alias those segments then reconstruct the entire image.  You'll have some border effects which you can compensate for by using overlapping boundaries and excluding those boundaries in the reconstruction.  Some untested code that is a rough approximation:
downSample=float(7874/23622)
resizeRatio = downSample*3937
#using 3937x3937 for 36 squares
img = Image.open(file)
newImg = Image.new(mode, (7874,7874), color)
for i in xrange(0,23622,3937):
 for j in xrange(0,23622,3937):
  imgb = img.crop(i,j,i+3937,i+3937)
  imgb.resize((resizeRatio,resizeRatio), Image.ANTIALIAS)
  imgbData = imgb.getdata()
  newImg.putdata(imgbData,1.0, i)

You can shift this and repeat it if you get lines where the squares meet

On Thu, Sep 8, 2011 at 7:07 AM, Craig Coleman (C) <[hidden email]> wrote:

Hi,

I have a really thorny problem.

I need to downsample a raster map that is 23622x23622 pixels to 7874x7874 pixels using the ANTIALIAS filter.

I have the following Python code:

>>> import Image
>>> img = Image.open(r"C:\temp\24bit_nd.tif")
>>> nimg = img.resize((7874,7874),Image.ANTIALIAS)

As soon as the resize method is called, python crashes instantly.  I presume this is a memory allocation issue.

Is there another way of performing anti-aliasing on such a large image (its 2.7GB uncompressed although I'm using LZW for storage).

I have tried converting the file to 8bit with a palette and this successfully downsamples but the ANTIALIAS is not performed.  What am I doing wrong?

Craig Coleman
Technical Lead
Information Systems, Ordnance Survey

L0F2, Adanac Drive, SOUTHAMPTON, United Kingdom, SO16 0AS
Phone: <a href="tel:%2B44%20%280%29%202380%20054641" value="+442380054641" target="_blank">+44 (0) 2380 054641
www.ordnancesurvey.co.uk | [hidden email]
Please consider your environmental responsibility before printing this email.

This email is only intended for the person to whom it is addressed and may contain confidential information. If you have received this email in error, please notify the sender and delete this email which must not be copied, distributed or disclosed to any other person.

Unless stated otherwise, the contents of this email are personal to the writer and do not represent the official view of Ordnance Survey. Nor can any contract be formed on Ordnance Survey's behalf via email. We reserve the right to monitor emails and attachments without prior notice.

Thank you for your cooperation.

Ordnance Survey
Adanac Drive
Southampton SO16 0AS
Tel: 08456 050505
http://www.ordnancesurvey.co.uk


_______________________________________________
Image-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/image-sig



_______________________________________________
Image-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/image-sig
Reply | Threaded
Open this post in threaded view
|

Re: What is the best way to anti-alias a very large resolution image in PIL

Ken Mankoff-2
In reply to this post by Craig Coleman (C)

Newbie to Python here so please excuse dumb suggestions, but...

Must you use pure Python and PIL?

It seems PyLibTiff was written to solve something like this.
https://code.google.com/p/pylibtiff/

Or you could perhaps load the TIFF with numpy which allows you to
load just parts of the file, down-sample in segments, then combine.

Or just use 3rd party tools (I have used gdal with very large files,
though none larger than my RAM).

   -k.


On Thu, 8 Sep 2011, Craig Coleman (C) wrote:

> Hi,
>
> I have a really thorny problem.
>
> I need to downsample a raster map that is 23622x23622 pixels to
> 7874x7874 pixels using the ANTIALIAS filter.
>
> I have the following Python code:
>
>>>> import Image
>>>> img = Image.open(r"C:\temp\24bit_nd.tif")
>>>> nimg = img.resize((7874,7874),Image.ANTIALIAS)
>
> As soon as the resize method is called, python crashes instantly.
> I presume this is a memory allocation issue.
>
> Is there another way of performing anti-aliasing on such a large
> image (its 2.7GB uncompressed although I'm using LZW for storage).
>
> I have tried converting the file to 8bit with a palette and this
> successfully downsamples but the ANTIALIAS is not performed.
> What am I doing wrong?
>
> Craig Coleman
> Technical Lead
> Information Systems, Ordnance Survey
> L0F2, Adanac Drive, SOUTHAMPTON, United Kingdom, SO16 0AS
> Phone: +44 (0) 2380 054641
> www.ordnancesurvey.co.uk <http://www.ordnancesurvey.co.uk/>  |
> [hidden email]
> Please consider your environmental responsibility before printing this
> email.
>
> This email is only intended for the person to whom it is addressed
> and may contain confidential information. If you have received
> this email in error, please notify the sender and delete this
> email which must not be copied, distributed or disclosed to any
> other person.
>
> Unless stated otherwise, the contents of this email are personal
> to the writer and do not represent the official view of Ordnance
> Survey. Nor can any contract be formed on Ordnance Survey's behalf
> via email. We reserve the right to monitor emails and attachments
> without prior notice.
>
> Thank you for your cooperation.
>
> Ordnance Survey
> Adanac Drive
> Southampton SO16 0AS
> Tel: 08456 050505
> http://www.ordnancesurvey.co.uk
>

_______________________________________________
Image-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/image-sig
Reply | Threaded
Open this post in threaded view
|

Re: What is the best way to anti-alias a very large resolution image in PIL

Ken Mankoff
In reply to this post by Craig Coleman (C)

Newbie to Python here so please excuse dumb suggestions, but...

Must you use pure Python and PIL?

It seems PyLibTiff was written to solve something like this.
https://code.google.com/p/pylibtiff/

Or you could perhaps load the TIFF with numpy which allows you to
load just parts of the file, down-sample in segments, then combine.

Or just use 3rd party tools (I have used gdal with very large files,
though none larger than my RAM).

   -k.


On Thu, 8 Sep 2011, Craig Coleman (C) wrote:

> Hi,
>
> I have a really thorny problem.
>
> I need to downsample a raster map that is 23622x23622 pixels to
> 7874x7874 pixels using the ANTIALIAS filter.
>
> I have the following Python code:
>
>>>> import Image
>>>> img = Image.open(r"C:\temp\24bit_nd.tif")
>>>> nimg = img.resize((7874,7874),Image.ANTIALIAS)
>
> As soon as the resize method is called, python crashes instantly.  I
> presume this is a memory allocation issue.
>
> Is there another way of performing anti-aliasing on such a large image
> (its 2.7GB uncompressed although I'm using LZW for storage).
>
> I have tried converting the file to 8bit with a palette and this
> successfully downsamples but the ANTIALIAS is not performed.  What am I
> doing wrong?
>
> Craig Coleman
> Technical Lead
> Information Systems, Ordnance Survey
> L0F2, Adanac Drive, SOUTHAMPTON, United Kingdom, SO16 0AS
> Phone: +44 (0) 2380 054641
> www.ordnancesurvey.co.uk <http://www.ordnancesurvey.co.uk/>  |
> [hidden email]
> Please consider your environmental responsibility before printing this
> email.
>
>
> This email is only intended for the person to whom it is addressed and may contain confidential information. If you have received this email in error, please notify the sender and delete this email which must not be copied, distributed or disclosed to any other person.
>
> Unless stated otherwise, the contents of this email are personal to the writer and do not represent the official view of Ordnance Survey. Nor can any contract be formed on Ordnance Survey's behalf via email. We reserve the right to monitor emails and attachments without prior notice.
>
> Thank you for your cooperation.
>
> Ordnance Survey
> Adanac Drive
> Southampton SO16 0AS
> Tel: 08456 050505
> http://www.ordnancesurvey.co.uk
>

_______________________________________________
Image-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/image-sig
Reply | Threaded
Open this post in threaded view
|

Re: What is the best way to anti-alias a very large resolution image in PIL

Charlie Clark-6
In reply to this post by Craig Coleman (C)
Hi Craig,

Am 08.09.2011, 13:07 Uhr, schrieb Craig Coleman (C)  
<[hidden email]>:

> Hi,
> I have a really thorny problem.
> I need to downsample a raster map that is 23622x23622 pixels to
> 7874x7874 pixels using the ANTIALIAS filter.
> I have the following Python code:
>
>>>> import Image
>>>> img = Image.open(r"C:\temp\24bit_nd.tif")
>>>> nimg = img.resize((7874,7874),Image.ANTIALIAS)
> As soon as the resize method is called, python crashes instantly.  I
> presume this is a memory allocation issue.

I think you may be right. Do you have the full traceback the error  
produces?

Is this using a 32-bit version of Python? Do you have access to a 64-bit  
system? For MS Windows there is a 64-bit PIL installer:

http://www.lfd.uci.edu/~gohlke/pythonlibs/#pil

> Is there another way of performing anti-aliasing on such a large image
> (its 2.7GB uncompressed although I'm using LZW for storage).

> I have tried converting the file to 8bit with a palette and this
> successfully downsamples but the ANTIALIAS is not performed.  What am I
> doing wrong?

Charlie
--
Charlie Clark
Managing Director
Clark Consulting & Research
German Office
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-600-3657
Mobile: +49-178-782-6226
_______________________________________________
Image-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/image-sig
Reply | Threaded
Open this post in threaded view
|

Re: What is the best way to anti-alias a very large resolution image in PIL

Andrew Wilson-10
In reply to this post by Craig Coleman (C)
Hello,
I've had similar problems with PIL, you may want to take a look at OpenCV it can open rather large images and resize them.
  Thanks
  Andrew

On Thu, Sep 8, 2011 at 7:07 AM, Craig Coleman (C) <[hidden email]> wrote:

Hi,

I have a really thorny problem.

I need to downsample a raster map that is 23622x23622 pixels to 7874x7874 pixels using the ANTIALIAS filter.

I have the following Python code:

>>> import Image
>>> img = Image.open(r"C:\temp\24bit_nd.tif")
>>> nimg = img.resize((7874,7874),Image.ANTIALIAS)

As soon as the resize method is called, python crashes instantly.  I presume this is a memory allocation issue.

Is there another way of performing anti-aliasing on such a large image (its 2.7GB uncompressed although I'm using LZW for storage).

I have tried converting the file to 8bit with a palette and this successfully downsamples but the ANTIALIAS is not performed.  What am I doing wrong?

Craig Coleman
Technical Lead
Information Systems, Ordnance Survey

L0F2, Adanac Drive, SOUTHAMPTON, United Kingdom, SO16 0AS
Phone: <a href="tel:%2B44%20%280%29%202380%20054641" value="+442380054641" target="_blank">+44 (0) 2380 054641
www.ordnancesurvey.co.uk | [hidden email]
Please consider your environmental responsibility before printing this email.

This email is only intended for the person to whom it is addressed and may contain confidential information. If you have received this email in error, please notify the sender and delete this email which must not be copied, distributed or disclosed to any other person.

Unless stated otherwise, the contents of this email are personal to the writer and do not represent the official view of Ordnance Survey. Nor can any contract be formed on Ordnance Survey's behalf via email. We reserve the right to monitor emails and attachments without prior notice.

Thank you for your cooperation.

Ordnance Survey
Adanac Drive
Southampton SO16 0AS
Tel: 08456 050505
http://www.ordnancesurvey.co.uk


_______________________________________________
Image-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/image-sig



_______________________________________________
Image-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/image-sig
Reply | Threaded
Open this post in threaded view
|

Re: What is the best way to anti-alias a very large resolution image in PIL

Craig Coleman (C)
Hi all,
 
Thanks for all of the response.  In the end, I used a combination of GDAL and Image Magick which are fast, reliable, extremely flexible and free.  Subsequently, we now use Python to call out GDAL and Image Magick as needed.
 
I changed my process to export to high resolution PDF in order to preserve the quality as PDF is vector-based rather than use a very high resolution TIFF.  I use gdal_translate with the --config GDAL_PDF_DPI=400 option to reduce the resolution to 7874 which also performs anti-aliasing on the fly as it happens.  After that, I use Image Magick to map the 24-bit raster to an 8-bit raster using a colour palette in another image - GDALs rgc2pct script can do this but it always applies a dodgy Floyd Steinberg ditther which produces horrible results, Image Magick can avoid the dither altogether somehow (clever stuff).  Finally, I use gdal_translate again to ensure the GeoTIFF tags are in place.  Voila - 8bit, 400dpi tiff is produced.
 
Thanks,

Craig Coleman
Technical Lead
Information Systems, Ordnance Survey

L0F2, Adanac Drive, SOUTHAMPTON, United Kingdom, SO16 0AS
Phone: +44 (0) 2380 054641
www.ordnancesurvey.co.uk | [hidden email]
Please consider your environmental responsibility before printing this email.

 


From: [hidden email] [mailto:[hidden email]] On Behalf Of Andrew Wilson
Sent: 13 September 2011 17:25
To: Craig Coleman (C)
Cc: [hidden email]
Subject: Re: [Image-SIG] What is the best way to anti-alias a very large resolution image in PIL

Hello,
I've had similar problems with PIL, you may want to take a look at OpenCV it can open rather large images and resize them.
  Thanks
  Andrew

On Thu, Sep 8, 2011 at 7:07 AM, Craig Coleman (C) <[hidden email]> wrote:

Hi,

I have a really thorny problem.

I need to downsample a raster map that is 23622x23622 pixels to 7874x7874 pixels using the ANTIALIAS filter.

I have the following Python code:

>>> import Image
>>> img = Image.open(r"C:\temp\24bit_nd.tif")
>>> nimg = img.resize((7874,7874),Image.ANTIALIAS)

As soon as the resize method is called, python crashes instantly.  I presume this is a memory allocation issue.

Is there another way of performing anti-aliasing on such a large image (its 2.7GB uncompressed although I'm using LZW for storage).

I have tried converting the file to 8bit with a palette and this successfully downsamples but the ANTIALIAS is not performed.  What am I doing wrong?

Craig Coleman
Technical Lead
Information Systems, Ordnance Survey

L0F2, Adanac Drive, SOUTHAMPTON, United Kingdom, SO16 0AS
Phone: <A href="tel:%2B44%20%280%29%202380%20054641" target=_blank value="+442380054641">+44 (0) 2380 054641
www.ordnancesurvey.co.uk | [hidden email]
Please consider your environmental responsibility before printing this email.

This email is only intended for the person to whom it is addressed and may contain confidential information. If you have received this email in error, please notify the sender and delete this email which must not be copied, distributed or disclosed to any other person.

Unless stated otherwise, the contents of this email are personal to the writer and do not represent the official view of Ordnance Survey. Nor can any contract be formed on Ordnance Survey's behalf via email. We reserve the right to monitor emails and attachments without prior notice.

Thank you for your cooperation.

Ordnance Survey
Adanac Drive
Southampton SO16 0AS
Tel: 08456 050505
http://www.ordnancesurvey.co.uk


_______________________________________________
Image-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/image-sig


This email is only intended for the person to whom it is addressed and may contain confidential information. If you have received this email in error, please notify the sender and delete this email which must not be copied, distributed or disclosed to any other person.

Unless stated otherwise, the contents of this email are personal to the writer and do not represent the official view of Ordnance Survey. Nor can any contract be formed on Ordnance Survey's behalf via email. We reserve the right to monitor emails and attachments without prior notice.

Thank you for your cooperation.

Ordnance Survey
Adanac Drive
Southampton SO16 0AS
Tel: 08456 050505
http://www.ordnancesurvey.co.uk


_______________________________________________
Image-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/image-sig
Reply | Threaded
Open this post in threaded view
|

Re: What is the best way to anti-alias a very large resolution image in PIL

kevin-28
In reply to this post by Craig Coleman (C)
If its a memory issue like people have suggested, then it's still possible to do.  You could break the image into chunks, resize those, then re-assemble them.  The .tile attribute will help you.  I've personally worked with files up to about 1.5GB with PIL successfully - even on a 600mHz computer with only 2GB of RAM (back in about 2000), but I'm not sure where the limit actually is, if any.

I'm looking for a good code sample to show you how to use the .tile attribute for this, but can't find any yet… the attached is pretty cryptic and horrible coding (from my "early" years :) with little useful documentation.  Fredrik really helped me understand it back then, so if you search the newsgroup archives for ".tile" you should probably find something useful.

You'd have to do something like:

1)  open the image
2)  modify the .tile attribute so that you're only working with a portion of the image (that you can handle in memory)
3)  resize the image
4)  save that portion of the image
5)  repeat the above for all sections of the image
6)  load them all and paste the resized ones back into one smaller image

I'd suggest that you have a bit of overlap in the files though, or you'll have artifacts where you paste them together.  This is due to the resampling errors right at the edge of an image.




Good luck!

Kevin.





On Sep 8, 2011, at 7:07 AM, Craig Coleman (C) wrote:

What is the best way to anti-alias a very large resolution image in PIL

Hi,

I have a really thorny problem.

I need to downsample a raster map that is 23622x23622 pixels to 7874x7874 pixels using the ANTIALIAS filter.

I have the following Python code:

>>> import Image
>>> img = Image.open(r"C:\temp\24bit_nd.tif")
>>> nimg = img.resize((7874,7874),Image.ANTIALIAS)

As soon as the resize method is called, python crashes instantly.  I presume this is a memory allocation issue.

Is there another way of performing anti-aliasing on such a large image (its 2.7GB uncompressed although I'm using LZW for storage).

I have tried converting the file to 8bit with a palette and this successfully downsamples but the ANTIALIAS is not performed.  What am I doing wrong?

Craig Coleman
Technical Lead
Information Systems, Ordnance Survey

L0F2, Adanac Drive, SOUTHAMPTON, United Kingdom, SO16 0AS
Phone: +44 (0) 2380 054641
www.ordnancesurvey.co.uk | [hidden email]
Please consider your environmental responsibility before printing this email.

This email is only intended for the person to whom it is addressed and may contain confidential information. If you have received this email in error, please notify the sender and delete this email which must not be copied, distributed or disclosed to any other person.

Unless stated otherwise, the contents of this email are personal to the writer and do not represent the official view of Ordnance Survey. Nor can any contract be formed on Ordnance Survey's behalf via email. We reserve the right to monitor emails and attachments without prior notice.

Thank you for your cooperation.

Ordnance Survey
Adanac Drive
Southampton SO16 0AS
Tel: 08456 050505
http://www.ordnancesurvey.co.uk

_______________________________________________
Image-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/image-sig


_______________________________________________
Image-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/image-sig

build_image.py (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: What is the best way to anti-alias a very large resolution image in PIL

kevin-28
In reply to this post by Craig Coleman (C)
I just found an article that Fredrik wrote based on a discussion we had on memory limits back in 1999.  Using the .tile attribute and doing your work in chunks is one sure-fire way of getting there, although it'll take some effort.  I hope this helps!



Kevin.



On Sep 8, 2011, at 7:07 AM, Craig Coleman (C) wrote:

What is the best way to anti-alias a very large resolution image in PIL

Hi,

I have a really thorny problem.

I need to downsample a raster map that is 23622x23622 pixels to 7874x7874 pixels using the ANTIALIAS filter.

I have the following Python code:

>>> import Image
>>> img = Image.open(r"C:\temp\24bit_nd.tif")
>>> nimg = img.resize((7874,7874),Image.ANTIALIAS)

As soon as the resize method is called, python crashes instantly.  I presume this is a memory allocation issue.

Is there another way of performing anti-aliasing on such a large image (its 2.7GB uncompressed although I'm using LZW for storage).

I have tried converting the file to 8bit with a palette and this successfully downsamples but the ANTIALIAS is not performed.  What am I doing wrong?

Craig Coleman
Technical Lead
Information Systems, Ordnance Survey

L0F2, Adanac Drive, SOUTHAMPTON, United Kingdom, SO16 0AS
Phone: +44 (0) 2380 054641
www.ordnancesurvey.co.uk | [hidden email]
Please consider your environmental responsibility before printing this email.

This email is only intended for the person to whom it is addressed and may contain confidential information. If you have received this email in error, please notify the sender and delete this email which must not be copied, distributed or disclosed to any other person.

Unless stated otherwise, the contents of this email are personal to the writer and do not represent the official view of Ordnance Survey. Nor can any contract be formed on Ordnance Survey's behalf via email. We reserve the right to monitor emails and attachments without prior notice.

Thank you for your cooperation.

Ordnance Survey
Adanac Drive
Southampton SO16 0AS
Tel: 08456 050505
http://www.ordnancesurvey.co.uk

_______________________________________________
Image-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/image-sig


_______________________________________________
Image-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/image-sig
Reply | Threaded
Open this post in threaded view
|

Re: What is the best way to anti-alias a very large resolution image in PIL

Fredrik Lundh
In reply to this post by Craig Coleman (C)
Looks like you've found a working approach, but I'm still a bit
curious what "crash" means here -- do you get a segmentation violation
or a MemoryError exception?  PIL needs about 2G to load that image
into memory and an additional 50% of that to finish the resizing (it's
done in two passes), so you need decent hardware, but unless the
memory allocator is messing things up, it shouldn't crash hard if it
runs out of memory.

>>> from PIL import Image
>>> im = Image.new("RGB", (22633, 22633))
>>> im
<PIL.Image.Image image mode=RGB size=22633x22633 at 0x7F8E422C6248>
>>> out = im.resize((7874, 7874), Image.ANTIALIAS)
>>> out
<PIL.Image.Image image mode=RGB size=7874x7874 at 0x7F8E4230E320>
>>> ^Z
$ ps u | grep python
91700     3151 28.9 23.9 2982192 2946292 pts/0 TN   13:49   0:56 python

</F>

On 8 September 2011 13:07, Craig Coleman (C)
<[hidden email]> wrote:

> Hi,
>
> I have a really thorny problem.
>
> I need to downsample a raster map that is 23622x23622 pixels to 7874x7874
> pixels using the ANTIALIAS filter.
>
> I have the following Python code:
>
>>>> import Image
>>>> img = Image.open(r"C:\temp\24bit_nd.tif")
>>>> nimg = img.resize((7874,7874),Image.ANTIALIAS)
>
> As soon as the resize method is called, python crashes instantly.  I presume
> this is a memory allocation issue.
>
> Is there another way of performing anti-aliasing on such a large image (its
> 2.7GB uncompressed although I'm using LZW for storage).
>
> I have tried converting the file to 8bit with a palette and this
> successfully downsamples but the ANTIALIAS is not performed.  What am I
> doing wrong?
>
> Craig Coleman
> Technical Lead
> Information Systems, Ordnance Survey
> L0F2, Adanac Drive, SOUTHAMPTON, United Kingdom, SO16 0AS
> Phone: +44 (0) 2380 054641
> www.ordnancesurvey.co.uk | [hidden email]
> Please consider your environmental responsibility before printing this
> email.
>
> This email is only intended for the person to whom it is addressed and may
> contain confidential information. If you have received this email in error,
> please notify the sender and delete this email which must not be copied,
> distributed or disclosed to any other person.
>
> Unless stated otherwise, the contents of this email are personal to the
> writer and do not represent the official view of Ordnance Survey. Nor can
> any contract be formed on Ordnance Survey's behalf via email. We reserve the
> right to monitor emails and attachments without prior notice.
>
> Thank you for your cooperation.
>
> Ordnance Survey
> Adanac Drive
> Southampton SO16 0AS
> Tel: 08456 050505
> http://www.ordnancesurvey.co.uk
>
>
> _______________________________________________
> Image-SIG maillist  -  [hidden email]
> http://mail.python.org/mailman/listinfo/image-sig
>
>
_______________________________________________
Image-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/image-sig