Page 1 of 1

Assertion failure at ../../magick/string.c:845

Posted: 2016-01-07T20:56:57-07:00
by impinball
OS: Ubuntu GNOME 15.10 64-bit
Version:

Code: Select all

Version: ImageMagick 6.8.9-9 Q16 x86_64 2015-08-06 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC Modules OpenMP
Delegates: bzlib djvu fftw fontconfig freetype jbig jng jpeg lcms lqr ltdl lzma openexr pangocairo png tiff wmf x xml zlib
With this command line, I've been getting frequent, almost 100% consistent assertion errors:

Code: Select all

$ convert -background white -alpha remove -set colorspace gray -separate -average -resize 700 -quality 0 "1st Movement.pdf[0]" PNG8:-
Here's the error I get (this crashes IM):

Code: Select all

convert: ../../magick/string.c:845: DestroyStringInfo: Assertion `string_info->signature == 0xabacadabUL' failed.
Here is the file in question. Note that the file itself is licensed CC-BY-NC 3.0 US, but if that causes problems, let me know, so I can generate the required exceptions.

From looking in the current source code, this appears to be the line in question.

Re: Assertion failure at ../../magick/string.c:845

Posted: 2016-01-07T22:08:48-07:00
by fmw42
Try the commands in this order. I am not sure that you need -set colorspace gray or even my -colorspace gray, since -separate makes grayscale images for each channel.

Code: Select all

convert -background white -alpha remove "1st Movement.pdf[0]" -separate -average -resize 700 -colorspace gray -quality 0  PNG8:-
Settings for PDF such as -background and -alpha should come before the input PDF. But operators, such a -separate, -average and -resize and the -quality setting should come afterwards.

This may not help. But it is a more proper IM 6 syntax.

I presume you are piping this to some other command. If not, then PNG8:- has no output image and your command would fail. You would need to do

Code: Select all

convert -background white -alpha remove "1st Movement.pdf[0]" -separate -average -resize 700 -colorspace gray -quality 0  PNG8:result.png

Re: Assertion failure at ../../magick/string.c:845

Posted: 2016-01-07T22:36:07-07:00
by fmw42
Looking at your image meta data (via identify -verbose), your first page of the pdf image is bi-level (i.e. 1bit per pixel) and thus is not a color image. Therefore no -set colorspace or -colorspace or -separate should be needed, though, those commands should not hurt.

The following command works fine for me on IM 6.9.3.0 Q16 Mac OSX and Ghostscript 9.16

Code: Select all

convert -background white -alpha remove "1st Movement.pdf[0]" -separate -average -resize 700 -colorspace gray -quality 0 PNG8:result.png
If this does not work for you, then you might consider upgrading IM and/or ghostscript.

For higher quality, you might consider:

Code: Select all

convert -background white -alpha remove -density 300 "1st Movement.pdf[0]" -separate -average -resize 700 -colorspace gray -quality 0 PNG8:result.png

Re: Assertion failure at ../../magick/string.c:845

Posted: 2016-01-09T07:58:04-07:00
by magick
We can reproduce the problem you posted and have a patch in ImageMagick 6.9.3-1 Beta, available by sometime tomorrow. Thanks.