anim_encoder icon indicating copy to clipboard operation
anim_encoder copied to clipboard

Traceback (most recent call last):

Open dimaromanenko opened this issue 11 years ago • 4 comments

Hi, script RuntimeError when 100 images need packing. List error: python anim_encoder.py ani2 ani2 packing, num rects: 2909 num frames: 50 Traceback (most recent call last): File "anim_encoder.py", line 234, in generate_animation(sys.argv[1]) File "anim_encoder.py", line 189, in generate_animation dy, dx = allocator.allocate(w, h) File "anim_encoder.py", line 111, in allocate raise RuntimeError() RuntimeError

dimaromanenko avatar Oct 18 '13 23:10 dimaromanenko

RuntimeError is being raised when it falls out with a lot of images.

def allocate(self, w, h):
    bh, bw = shape(self.bitmap)

    for row in xrange(bh - h + 1):
        if self.available_space[row] < w:
            continue

        for col in xrange(bw - w + 1):
            if self.bitmap[row, col] == 0:
                if not self.bitmap[row:row+h,col:col+w].any():
                    self.bitmap[row:row+h,col:col+w] = 1
                    self.available_space[row:row+h] -= w
                    self.num_used_rows = max(self.num_used_rows, row + h)
                    return row, col

    raise RuntimeError()

perpetual-hydrofoil avatar Jan 24 '16 15:01 perpetual-hydrofoil

I'm seeing this same error with 45 images on RHEL 7.

johnallred avatar Sep 15 '16 22:09 johnallred

There is a constant set in anim_encoder.py that limits the resulting png to 10,000 lines. It seems your animation has so much content as to not be able to fit within 10,000 vertical lines.

You could try increasing the limit, however the resulting PNG will likely have a rather large filesize if you have that much image data.

wbond avatar Jul 20 '17 00:07 wbond

@wbond That makes sense; perhaps a parameter or more info in the error message would make sense. The X11-Canvas-Screencast project (https://github.com/rprichard/x11-canvas-screencast/issues/2) makes use of this in order to essentially make videos, so those will probably end up with a large file size as you point out.

https://github.com/sublimehq/anim_encoder/blob/master/anim_encoder.py#L44

perpetual-hydrofoil avatar Aug 11 '17 15:08 perpetual-hydrofoil