Menu

MemoryError

Tomasz
2008-04-18
2013-05-02
  • Tomasz

    Tomasz - 2008-04-18

    I keep getting the following error when I try use python ZoomifyFile:

    # python ZoomifyFileProcessor.py ~/57-161197-32.jpg
    Traceback (most recent call last):
      File "ZoomifyFileProcessor.py", line 135, in <module>
        processor.ZoomifyProcess(sys.argv[1:])
      File "ZoomifyFileProcessor.py", line 127, in ZoomifyProcess
        self.processImage()
      File "/usr/local/www/dev1.adams.co.uk/extlib/ZoomifyImage/ZoomifyBase.py", line 205, in processImage
        self.processRowImage(tier=tier, row=row)
      File "/usr/local/www/dev1.adams.co.uk/extlib/ZoomifyImage/ZoomifyBase.py", line 288, in processRowImage
        tempImage = imageRow.resize((imageWidth/2, imageHeight/2), PIL.Image.ANTIALIAS)
      File "/usr/local/lib/python2.5/site-packages/PIL/Image.py", line 1264, in resize
        im = self.im.stretch(size, resample)
    MemoryError

    I saw on the forum others having similar problem, however the issue has not seemed to be fixed it the python script.
    Any help would be hugely appreciated.

     
    • adam smith

      adam smith - 2008-04-18

      How large is the image that you are trying to process?

       
      • Tomasz

        Tomasz - 2008-04-23

        The file size it: 585 KB
        The resolution: 3516 x 3585

        You can download it here: http://realtsp.com/57-161197-32.jpg if you like to reproduce the error.

         
    • adam smith

      adam smith - 2008-04-24

      That file size is quite small, the processor should be able to handle images many times that size. The memory problems people have reported are with images over 1Gb.

      Can you give me more information about your PIL version, RAM, etc?

       
    • Tomasz

      Tomasz - 2008-04-28

      PIL version: 1.1.6
      RAM: 4GB

      Did the image work correctly on your environment?

       
      • adam smith

        adam smith - 2008-04-28

        I didn't see the memory error, and as I say, this is a relatively tiny image. The only thing I can think is that because this is a Python runtime error, either something else on your system is hogging memory, or perhaps you are processing a large number of images in a single process and my code is leaking memory?

        Sorry to be taking shots in the dark on this, but I don't have much to go on.

         
    • Tomasz

      Tomasz - 2008-04-29

      Hi

      Sorry for the confusion with the previous error, causes by storing the wrong version on our mirror server.
      I am able to get a different error on two different servers that details are bellow:

      server 1:
      FreeBSD 7.0-STABLE FreeBSD 7.0-STABLE #2: Tue Apr  1 14:44:00 BST 2008 DELL-SC1435-SAS5i  amd64
      python25-2.5.2_1
      py25-imaging-1.1.6_2

      server 2:
      Linux 2.6.24-16-server #1 SMP Thu Apr 10 13:58:00 UTC 2008 i686 GNU/Linux
      python 2.5.2-0ubuntu1
      python-imaging 1.1.6-1ubuntu5

      When I process the image I am getting the errors in version 1_31. I know that similar error has been fixed already in version 1.3:
      http://www.stonemind.net/blog/2007/07/03/zoomifyimage-13-released/

      but I am still getting it. The only differences are line numbers.

      The versions that I downloaded are from:
      http://mesh.dl.sourceforge.net/sourceforge/zoomifyimage/ZoomifyImage1_31.tar.gz

      ZoomifyImage1_31:
      # python ZoomifyFileProcessor.py ~/57-161197-32.jpg
      Traceback (most recent call last):
        File "ZoomifyFileProcessor.py", line 129, in <module>
          processor.ZoomifyProcess(sys.argv[1:])
        File "ZoomifyFileProcessor.py", line 122, in ZoomifyProcess
          self.processImage()
        File "/usr/home/tomasz/ZoomifyImage1_31/ZoomifyBase.py", line 207, in processImage
          self.processRowImage(tier=tier, row=row)
        File "/usr/home/tomasz/ZoomifyImage1_31/ZoomifyBase.py", line 310, in processRowImage
          self.processRowImage(tier=(tier-1), row=(row/2))
        File "/usr/home/tomasz/ZoomifyImage1_31/ZoomifyBase.py", line 308, in processRowImage
          self.processRowImage(tier=(tier-1), row=((row-1)/2))
        File "/usr/home/tomasz/ZoomifyImage1_31/ZoomifyBase.py", line 275, in processRowImage
          self.saveTile(imageRow.crop([ul_x, ul_y, lr_x, lr_y]), tier, column, row)
        File "ZoomifyFileProcessor.py", line 105, in saveTile
          image.save(self.getFileReference(scaleNumber, column, row), 'JPEG', quality=self.qualitySetting)
        File "/usr/local/lib/python2.5/site-packages/PIL/Image.py", line 1405, in save
          save_handler(self, fp, filename)
        File "/usr/local/lib/python2.5/site-packages/PIL/JpegImagePlugin.py", line 409, in _save
          ImageFile._save(im, fp, [("jpeg", (0,0)+im.size, 0, rawmode)])
        File "/usr/local/lib/python2.5/site-packages/PIL/ImageFile.py", line 490, in _save
          e.setimage(im.im, b)
      SystemError: tile cannot extend outside image

      It works correctly with other images such as this one:
      http://realtsp.com/56-161113-48.jpg

       
      • adam smith

        adam smith - 2008-04-30

        So, you are no longer seeing the memory error? I'll take a look at the tile error and release a bug release version when its fixed. I may not get to this right away though, are you under time pressure?

         
    • Tomasz

      Tomasz - 2008-04-30

      I am no longer seeing the memory error.

      I am not under the time pressure, however 3 images on the website are mission the zoom feature at the moment. New batches of images are coming from the photo studio every Thursday.

      I would be very grateful if you could have a look at this issue.

       
    • Tomasz

      Tomasz - 2008-05-09

      Photo studio started hammer us with large number of images and every batch has a couple of those "tile" errors.
      Would you be able to have a look at this issue in the close future?

       
    • adam smith

      adam smith - 2008-05-09

      I believe I have a fix, but I can't commit to CVS because Sourceforge appears to be having problems, and I don't want to package a release just yet, as I may do some other maintenance on the code. Can I send you an email with the fix?

      Aside from that, could I have your permission to use that sneaker image you sent in the packaged distribution for future testing purposes? And finally, could you give me your full name so I can acknowledge that you helped me debug the software in the README file?

      Feel free to email me offline with this information at asmith@agile-software.com .

       

Log in to post a comment.