Page 1 of 1

Modifying one page of multipage TIF

Posted: 2015-07-31T11:20:12-07:00
by ceepea
I have a very similiar situation, need to create a fax tiff image from a standard image to a different file name, but only change the first page. I am having problems with the syntax, trying to do the clone and replace suggestion. Using Windows Version: ImageMagick 6.8.8-5 Q8 x86 2014-02-08

Code: Select all

convert image.tif tiff:image.tif ^
(-clone 1 ^
 -font Arial -pointsize 40 -draw "gravity NorthWest  text 100,65 'Johahn Sebastian Bach' "^
 -font Arial -pointsize 40 -draw "gravity NorthEast  text 10,10 'No. 1040              ' "^
 -font Arial -pointsize 40 -draw "gravity NorthEast  text 00,175 '07/30/2015           ' "^
 -font Arial -pointsize 50 -draw "gravity Center  text -500,-50 'Payee Name Company' "^
 -font Arial -pointsize 50 -draw "gravity Center  text 750,-50 '300.35 ' "^
 -font Arial -pointsize 50 -draw "gravity West  text 50,50 'Three hundred and 35/100 ' "^
 -font Arial -pointsize 25 -draw "gravity West  text 50,110 'Deluxe Institution ' "^
 -font Arial -pointsize 25 -draw "gravity West  text 50,140 'Your City, State 12345 ' "^
 -font MICR -pointsize 40 -draw "gravity SouthWest   text 100,65 ' d89d   o94o110555654089c      a1040a' " ^
 -compress group4  -threshold 75% )^
 -delete 1 image.tif ^
 test1.tif
If I do not use the clone and delete lines , the batch file works but i get the changes on every page of the image.
useing the clone and delete line i get the error message (in some form or another)
convert.exe: unable to open image `(-clone': No such file or directory
Looking at the online docs, i am unable to figure out what I'm doing wrong. What am I missing or not understanding about the process?

Re: Saving multipage TIF

Posted: 2015-07-31T11:37:07-07:00
by fmw42
There must be spaces on each side of and parenthesis. The image sequence starts at 0. So the first frame is -clone 0. You must create a new frame/layer/page as you have, then swap the last frame/layer/page with the first one using -swap 0,-1. The -1 represents the last one. Then delete the last one, which was the original first one. The tiff:image.tif seems superfluous or I do not understand why you have it there. Put a space before each ^ for newline. You cannot process two input image and get two different named output images. You must do each separately. This assumes that image.tif has multiple pages

Try

Code: Select all

convert image.tif  ^
( -clone 0 ^
 -font Arial -pointsize 40 -draw "gravity NorthWest  text 100,65 'Johahn Sebastian Bach' " ^
 -font Arial -pointsize 40 -draw "gravity NorthEast  text 10,10 'No. 1040              ' " ^
 -font Arial -pointsize 40 -draw "gravity NorthEast  text 00,175 '07/30/2015           ' " ^
 -font Arial -pointsize 50 -draw "gravity Center  text -500,-50 'Payee Name Company' " ^
 -font Arial -pointsize 50 -draw "gravity Center  text 750,-50 '300.35 ' " ^
 -font Arial -pointsize 50 -draw "gravity West  text 50,50 'Three hundred and 35/100 ' " ^
 -font Arial -pointsize 25 -draw "gravity West  text 50,110 'Deluxe Institution ' " ^
 -font Arial -pointsize 25 -draw "gravity West  text 50,140 'Your City, State 12345 ' " ^
 -font MICR -pointsize 40 -draw "gravity SouthWest   text 100,65 ' d89d   o94o110555654089c      a1040a' " ^
 -threshold 75% -compress group4 ) ^
 -swap 0,-1 +delete ^
 test1.tif
or

Code: Select all

convert image.tif  ^
( -clone 0 ^
 -font Arial -pointsize 40 -draw "gravity NorthWest  text 100,65 'Johahn Sebastian Bach' " ^
 -font Arial -pointsize 40 -draw "gravity NorthEast  text 10,10 'No. 1040              ' " ^
 -font Arial -pointsize 40 -draw "gravity NorthEast  text 00,175 '07/30/2015           ' " ^
 -font Arial -pointsize 50 -draw "gravity Center  text -500,-50 'Payee Name Company' " ^
 -font Arial -pointsize 50 -draw "gravity Center  text 750,-50 '300.35 ' " ^
 -font Arial -pointsize 50 -draw "gravity West  text 50,50 'Three hundred and 35/100 ' " ^
 -font Arial -pointsize 25 -draw "gravity West  text 50,110 'Deluxe Institution ' " ^
 -font Arial -pointsize 25 -draw "gravity West  text 50,140 'Your City, State 12345 ' " ^
 -font MICR -pointsize 40 -draw "gravity SouthWest   text 100,65 ' d89d   o94o110555654089c      a1040a' " ^
 ) ^
 -swap 0,-1 +delete -threshold 75% -compress group4 ^
 test1.tif

Re: Saving multipage TIF

Posted: 2015-08-03T10:20:32-07:00
by ceepea
hi. trying the first option, i got error message
Invalid Parameter - (
taking a closer look, i saw that there was no space after the "^" on line 1. put it in , but then i got error message of
Invalid drive specification.
-swap was unexpected at this time.
So I made sure there was a space after each "^". Now i get an error message of
Invalid drive specification.
was unexpected at this time.

D:\wip\> -threshold 75 -compress group4 ) ^
so, went to the second option. made sure there were spaces by "^" and "(" and basically the same problem
Invalid drive specification.
-swap was unexpected at this time.

D:\wip\> -swap 0,-1 +delete -threshold 75 -compress group4 ^
on a whim i tried putting that line before the ")" but that didn't work either.

Re: Saving multipage TIF

Posted: 2015-08-03T10:39:28-07:00
by fmw42
Upload your tif file to dropbox.com and put a link here, so I can test my version of your command. I am not a Windows user so am not sure why there is a reference to your D drive unless that where you current directory resides from which you are issuing the command. But I can test the unix equivalent of the command.

Re: Saving multipage TIF

Posted: 2015-08-03T10:42:55-07:00
by fmw42
So I made sure there was a space after each "^". Now i get an error message of
There should be no spaces after the line ending ^, just before them. But spaces on each side of each parenthesis.

Re: Saving multipage TIF

Posted: 2015-08-03T10:44:02-07:00
by ceepea
hmm, i'm going to start a new topic as i can't get a batch file to work when parenthesis are tried.

I don't have dropbox and using a *nix machine is not an option for this job.

Re: Saving multipage TIF

Posted: 2015-08-03T10:46:15-07:00
by fmw42
Batch files have different syntax, such as needing to double %. See http://www.imagemagick.org/Usage/windows/

Does the script work OK as a standalone command pasted into your Command Window

Re: Saving multipage TIF

Posted: 2015-08-03T10:50:30-07:00
by fmw42
hmm, i'm going to start a new topic as i can't get a batch file to work when parenthesis are tried.
I have split your posts to a new topic.

Re: Modifying one page of multipage TIF

Posted: 2015-08-03T16:15:34-07:00
by ceepea
hi Fred (or any other admin), can the "Argh" reply i gave at the original post be moved over to here? It got posted before I saw the "split" message. thanks.