Page 1 of 1
Append an .png to several tif files
Posted: 2018-09-06T17:01:46-07:00
by mido_nasrat
hi all
i need a command line (.bat) using magick.exe to attach an image to a tif
lets say:
i have a folder of Tif images and i want to attach a .png image to each tif image and each tif image stay with the same name
i hope you got what i mean.
windows 8.1
ImageMagick-7.0.8-11-portable-Q16-x86
Re: Append an .png to several tif files
Posted: 2018-09-06T17:27:07-07:00
by snibgo
What do you mean by "attach"? Do you want the png to appear on the right of each tiff, or below it, or composed over it, or what?
Second question: can all of your tiffs and png fit into your memory at the same time? If they can, perhaps you can use a single "magick" command. Otherwise, you will need a shell loop, eg with "for".
Re: Append an .png to several tif files
Posted: 2018-09-06T17:57:23-07:00
by mido_nasrat
thanks snibgo for your replay
1st
you know that 1 tif image can has images inside it, i want to add an external image to be at the end of theses
for example image.tif has inside it 4 images i want to add an external one lets say photo.png
so after the merging i will have image.tif that have 5 images inside it (4+photo.png at the end)
2nd
look i have a folder that that have a random names of tif images and i want to keep their names , all i want to do just put the photo.png in the end of each tif image in that folder
i hope i explained what i need well
thank you so much again for your replay
Re: Append an .png to several tif files
Posted: 2018-09-06T18:19:33-07:00
by fmw42
try
Code: Select all
magick image.tiff image.png image.tiff
for one image at a time
or for a whole folder, then
you will need to write a script loop over each image in your folder and do the command above for it. The script loop syntax will depend upon your OS (Windows vs Unix)
Is your tiff multi-paged or multi-layered? Perhaps you can post a link to an example TIFF so we can see what kind it is. You can post to any free hosting service that won't change its format, such as dropbox.com and then put the URL here
Re: Append an .png to several tif files
Posted: 2018-09-06T23:04:45-07:00
by mido_nasrat
thanks fmw42 for yor reply
i'm using
windows 8.1
ImageMagick-7.0.8-11-portable-Q16-x86
i tried the code that you wrote before but this code need exactly the names of the files to be static
i tried also this one
Code: Select all
magick.exe convert test.tif flag.png test.tif
but its the same issue
i want the code to take any tif (multi-paged) image with any name and to add an static .png file to the end of that and keep the original name as it was
so what i mean for example
england.tif contains 4 multi-pages i wand to add flag.png to the end so the output will be england.tif (the same name) but now contain 5 multi-pages
so what i want is take a tif file with the same name and put a flag.png to the end of the pages then loop for each multi-paged .tif and put the flag.png in the end without renaming or without being static with name
usa.tif (3 multi-pages) ==after the code==> usa.tif contain (4 multi-pages) *flag.png added in the end
same file name (3 pages)====> adding flag.png ====> same file name (4 pages)
brazil.tif(5 multi-pages) ==after the code==> brazil.tif contain (6 multi-pages) *flag.png added in the end
same file name (5 pages)====> adding flag.png ====> same file name (6 pages)
so i want the code to take the file name as it will be (to be dynamic batch) and add a static image to the end of the pages or each tif multi-paged file
Folder contain (this folder will have a new files everyday with new names)
||
||
||
\/
usa.tif (1 pages)
england.tif (2 page)
brazil.tif (3 pages)
egypt.tif (4 pages)
france.tif (5 pages)
xxxxx.tif (x pages)
||
||
the code
||
||
\/
take the input file(s) and adding a "flag.png" to the end.
||
||
the output
||
||
\/
usa.tif (2 pages)
england.tif (3 page)
brazil.tif (4 pages)
egypt.tif (5 pages)
france.tif (6 pages)
xxxxx.tif (x+1 pages)
Re: Append an .png to several tif files
Posted: 2018-09-07T02:20:59-07:00
by snibgo
Okay, so you want the same image, say photo.png, to be added as an image to the end of the images in each tiff. I would put the command Fred showed and put it in a "for" loop, like this:
Code: Select all
for %F in (*.tiff) do magick %F photo.png %F
That command should work if typed at the CMD command line. If you put it in a BAT file, double each %:
Code: Select all
for %%F in (*.tiff) do magick %%F photo.png %%F
This will change all the tiff files, so you can't simply repeat the command without adding the image twice. I suggest you backup the directory first, in case of problems.
Re: Append an .png to several tif files
Posted: 2018-09-07T03:00:16-07:00
by mido_nasrat
snibgo wrote: ↑2018-09-07T02:20:59-07:00
Okay, so you want the same image, say photo.png, to be added as an image to the end of the images in each tiff. I would put the command Fred showed and put it in a "for" loop, like this:
Code: Select all
for %F in (*.tiff) do magick %F photo.png %F
That command should work if typed at the CMD command line. If you put it in a BAT file, double each %:
Code: Select all
for %%F in (*.tiff) do magick %%F photo.png %%F
This will change all the tiff files, so you can't simply repeat the command without adding the image twice. I suggest you backup the directory first, in case of problems.
can i give you a hug
it's what i want thank you so much
final thing please its only work only if the name if the tif file has no spaces
for example
1 - usa 2018 .tif not working
1-usa2018.tif working
and realy thank you so much you helped me alot for my daily work
Re: Append an .png to several tif files
Posted: 2018-09-07T03:29:09-07:00
by snibgo
Add quotes within the magick command, eg:
Code: Select all
for %F in (*.tiff) do magick "%F" photo.png "%F"
Re: Append an .png to several tif files
Posted: 2018-09-07T03:47:15-07:00
by mido_nasrat
it's working now
i don't know what to say you made me happy, thank you snibgo i wish you great life
thanks fmw42 too