Error: Ignoring invalid annotation, output may be incorrect.

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
mihailyanchev
Posts: 4
Joined: 2018-07-24T07:33:55-07:00
Authentication code: 1152

Error: Ignoring invalid annotation, output may be incorrect.

Post by mihailyanchev »

Hi everyone, I am trying to convert and split a pdf to png in python using the following three lines:

Code: Select all

import Image, ImageOps
import subprocess, sys, os

filename = "99-005445-00043-039.pdf"
prefix = filename[filename.rfind('/') + 1:-4]
cmd = 'convert -density 600 -depth 8 -strip -background "#FFFFFF" -alpha off -colorspace "Gray" %s working/%s-%%d.png' % (filename, prefix)
subprocess.call([cmd], shell=True)
and I always get the following error even thought the conversion finishes successfully and the output is correct:

Code: Select all

Error: Ignoring invalid annotation, output may be incorrect.
I cannot figure out what it means or how to fix it. I do not really want to suppress it in case other errors are triggered. I tried removing certain options to see whether that triggers it. I suspect it might be the last part of the convert command working/%s-%%d.png which instructs how the split images should be named.

Any help will be appreciated.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Error: Ignoring invalid annotation, output may be incorrect.

Post by snibgo »

What version of IM are you using?

Your command syntax is wrong (but will work, sort of, in some versions of IM). The correct syntax is to list the operations in the order you want them performed:

1. set any settings required before reading the file (eg -density 600 -background "#FFFFFF")

2. Read the input eg 99.pdf

3. Operate on the image, eg -strip -alpha off -colorspace "Gray"

4. Save the output eg abc.png.

I suggest you echo or print the value of cmd, to verify the command is reasonable.
snibgo's IM pages: im.snibgo.com
mihailyanchev
Posts: 4
Joined: 2018-07-24T07:33:55-07:00
Authentication code: 1152

Re: Error: Ignoring invalid annotation, output may be incorrect.

Post by mihailyanchev »

Thanks for the quick reply.

The version is imagemagick: stable 7.0.8-7 (bottled). Installed via homebrew (I work on a Mac)

Otherwise I did rearrange the command and here is the print:

Code: Select all

>>> cmd = 'convert -density 600 -depth 8 -background "#FFFFFF" %s -strip -alpha off -colorspace "Gray" working/%s-%%d.png' % (filename, prefix)
>>> print cmd
convert -density 600 -depth 8 -background "#FFFFFF" 99-005445-00043-039.pdf -strip -alpha off -colorspace "Gray" working/99-005445-00043-039-%d.png
However, I still get the error. The result is not really changed.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Error: Ignoring invalid annotation, output may be incorrect.

Post by snibgo »

cmd looks okay.

Do you get any error message other than "Error: Ignoring invalid annotation, output may be incorrect."? If not, then the message is coming from Ghostscript, not ImageMagck, and it means GS thinks something is wrong with the PDF. What version of GS are you using? If older than 9.19, I suggest you upgrade. That might cure the error message.
snibgo's IM pages: im.snibgo.com
mihailyanchev
Posts: 4
Joined: 2018-07-24T07:33:55-07:00
Authentication code: 1152

Re: Error: Ignoring invalid annotation, output may be incorrect.

Post by mihailyanchev »

Thanks again, most kind sir.

The GS version is 9.23, which should be the newest. But I believe you are right and this error comes from GS.
For now I am going to leave it at that and just live with the error being shown every time. I am wondering whether it is an issue with converting files originally in Croatian for this task. I will see whether it gives me a similar error for other pdf files in English.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Error: Ignoring invalid annotation, output may be incorrect.

Post by fmw42 »

I am not sure if this will help. But Ghostscript may not have your Croatian font in its list of fonts. Perhaps it does not know what to use in that case thought I would have thought it would do a font substitution. See gs_fonts at https://www.imagemagick.org/download/delegates/ or from the Ghostscript web site. Are these installed on your system and can Ghostscript find them? Putting the path to where these are stored in your PATH environment variable may help. I put mine in my .profile file.
mihailyanchev
Posts: 4
Joined: 2018-07-24T07:33:55-07:00
Authentication code: 1152

Re: Error: Ignoring invalid annotation, output may be incorrect.

Post by mihailyanchev »

Thanks @fmw42. I did download the font package and set up the environmental variable so that GS can find them. It keeps giving me the message. I might try with an alternative fonts package from GS as well. However, I feel like I can live with it for now, since it still does the job.
Post Reply