Annotate pages with customized page number (Perl)
Posted: 2013-07-16T06:10:23-07:00
I'm using Perl. I have an ImageMagick object containing 16 pages. I'd like to annotate each page with a text string that derives from the page number. However, I don't want to use the page number straight (unmodified), I want to format it in a certain way. If I wanted to use the page number straight (unmodified), I could use a single Annotate command using the '%p' escape: $image->Annotate(text=>'%p'... ). However, if I want to format the page number first (which I can do in Perl), I don't know how to use a single Annotate command with my customized text. I tried to save my formatted text in text files called "label_1.txt", "label_2.txt", "label_3.txt"... etc and then read their contents using the "@" text file character: $image->Annotate(text=>'@label_%p.txt'... ). But it seems that "@" makes the rest of the line literal, i.e. the "%p" is no longer interpreted by Annotate as a page number. Is there a way to Annotate multiple pages with custom-formatted text? Thanks.