Tiling very large image exits with Abort trap: 6

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
sedwo
Posts: 9
Joined: 2018-02-14T09:47:10-07:00
Authentication code: 1152

Tiling very large image exits with Abort trap: 6

Post by sedwo »

I'm trying to convert a very large image into 256x256px tiles. The command works on smaller images.

Code: Select all

magick imageSizeOf21Kx28K_8bit.png -monitor -crop 256x256 -set filename:f "tile_%[fx:page.x],%[fx:page.y]" "./tiledImageFolder/%[filename:f]_1.0.png"
Results in:
Assertion failed: (resource_info.file >= 0), function RelinquishMagickResource, file MagickCore/resource.c, line 1024.
Abort trap: 6
sedwo
Posts: 9
Joined: 2018-02-14T09:47:10-07:00
Authentication code: 1152

Re: Tiling very large image exits with Abort trap: 6

Post by sedwo »

Using Version: ImageMagick 7.0.7-22 Q16 x86_64 2018-01-22
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Tiling very large image exits with Abort trap: 6

Post by snibgo »

Ideally, IM would give a more informative error message. Perhaps there is a memory allocation problem.

From your filename, I guess there are 21000x28000 pixels. In Q16, this needs 4.7GB memory for the input image, and the same again for the output pixels. There are about 9130 output images, and each has an overhead.

How much memory do you have? Using Q8 will halve the memory usage.

Limiting map and memory will force pixels to disk, at the expense of time. Does that complete?

Another option may be to tile in stages, eg first tile into 10240x10240, then tile each result into 256x256.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Tiling very large image exits with Abort trap: 6

Post by fmw42 »

How big is the input image in width and height and color depth? Can you provide your input image? You can post to some free hosting service such as dropbox.com and put the URL here. Are you running on a hosted server? What is your RAM capacity?
sedwo
Posts: 9
Joined: 2018-02-14T09:47:10-07:00
Authentication code: 1152

Re: Tiling very large image exits with Abort trap: 6

Post by sedwo »

I'm running on an i7, quad-core, with 16Gigs or RAM.
The image is 21000x28000px @ 8bit (256 colour, PNG8)
If memory is the issue, limiting it to use swap space is fine. This doesn't have to be a speedy operation.

What's Q8? I see Q16 noted in the version string.

I cannot share the image as it's confidential. But perhaps simply generating your own might do the job. It's actually a large PDF converted to PNG.
sedwo
Posts: 9
Joined: 2018-02-14T09:47:10-07:00
Authentication code: 1152

Re: Tiling very large image exits with Abort trap: 6

Post by sedwo »

FYI:

Code: Select all

magick -list resource
Resource limits:
Width: 107.374MP
Height: 107.374MP
Area: 34.3597GP
Memory: 16GiB
Map: 32GiB
Disk: unlimited
File: 192
Thread: 1
Throttle: 0
Time: unlimited
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Tiling very large image exits with Abort trap: 6

Post by Bonzo »

What's Q8? I see Q16 noted in the version string.
8Bit and 16bit versions of Imagemagick
I cannot share the image as it's confidential. But perhaps simply generating your own might do the job. It's actually a large PDF converted to PNG.
Not really an excuse; you could make a non confidential version and share that. We could make a version but not using your process it could be slightly different.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Tiling very large image exits with Abort trap: 6

Post by magick »

ImageMagick tracks resource consumption to help manage resource demand. It appears that your image is trying to release one more *file* resource than was acquired. That's a bug. However, we need to reproduce the problem before we can offer a fix. If you could post a URL to an image that produces the problem, we will have a fix within a day or two. We did try to reproduce the problem ourselves but our simple example runs without complaint:

Code: Select all

$ convert logo: logo.pdf
$ convert logo.pdf logo.png
sedwo
Posts: 9
Joined: 2018-02-14T09:47:10-07:00
Authentication code: 1152

Re: Tiling very large image exits with Abort trap: 6

Post by sedwo »

Here you go: (png file) https://we.tl/K2LkvI7LI1

Code: Select all

magick largeImage_21Kx28K.png -monitor -crop 256x256 -set filename:f "tile_%[fx:page.x],%[fx:page.y]" "./tiledImageFolder/%[filename:f]_1.0.png"
Output:
Assertion failed: (resource_info.file >= 0), function RelinquishMagickResource, file MagickCore/resource.c, line 1024.
Abort trap: 6
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Tiling very large image exits with Abort trap: 6

Post by magick »

Thanks for the problem report. We can reproduce it and will have a patch to fix it in GIT master branch @ https://github.com/ImageMagick/ImageMagick within a few days. The patch will be available in the beta releases of ImageMagick @ https://www.imagemagick.org/download/beta/ within a few days.
sedwo
Posts: 9
Joined: 2018-02-14T09:47:10-07:00
Authentication code: 1152

Re: Tiling very large image exits with Abort trap: 6

Post by sedwo »

Splendid. 👍

I've installed using

Code: Select all

brew install imagemagick
on my Mac.

What's the process to update it to the correct beta release?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Tiling very large image exits with Abort trap: 6

Post by magick »

We should have a new release tomorrow. It may take some time before brew updates to the latest release. You can always download and install from source-- but wait until tomorrow for the latest patches to mirror worldwide.
Post Reply