Page 1 of 1

Tiling very large image exits with Abort trap: 6

Posted: 2018-02-16T10:11:55-07:00
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

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

Posted: 2018-02-16T10:13:09-07:00
by sedwo
Using Version: ImageMagick 7.0.7-22 Q16 x86_64 2018-01-22

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

Posted: 2018-02-16T10:35:42-07:00
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.

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

Posted: 2018-02-16T10:36:35-07:00
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?

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

Posted: 2018-02-16T10:48:53-07:00
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.

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

Posted: 2018-02-16T10:56:45-07:00
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

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

Posted: 2018-02-16T14:25:16-07:00
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.

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

Posted: 2018-02-17T09:35:04-07:00
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

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

Posted: 2018-02-17T19:18:54-07:00
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

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

Posted: 2018-02-17T19:43:09-07:00
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.

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

Posted: 2018-02-18T08:44:52-07:00
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?

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

Posted: 2018-02-18T09:50:18-07:00
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.