Page 1 of 1

Resizing, Cropping & Converting a series of Images to Patrol Cycle Animated GIF + adding Watermark

Posted: 2016-01-22T20:07:33-07:00
by funkyavocado
I have a series of images that I want to convert to an animated gif that plays forwards and backwards. In the process I also want to resize and crop them. I'd like the animated gif to have a watermark.

This is what I have that works great without the watermark:

Code: Select all

convert c:\sourceImages\*.jpg -resize "600x400^" -gravity center -crop 600x400+0+0 +repage -coalesce -duplicate 1,-2-1 -set delay 1 -set dispose previous -layers OptimizePlus -quiet -loop 0 c:\finalImages\final.gif
When I add a watermark, it only appears on 1 frame:

Code: Select all

convert c:\sourceImages\*.jpg -resize "600x400^" -gravity center -crop 600x400+0+0 +repage -draw -coalesce -draw 'image SrcOver 0,0 image.jpg' -duplicate 1,-2-1 -set delay 1 -set dispose previous -layers OptimizePlus -quiet -loop 0 c:\finalImages\final.gif
As a test I tried

Code: Select all

convert c:\sourceImages\*.jpg -resize "600x400^" -gravity center -crop 600x400+0+0 +repage -draw -coalesce -draw "text 100,100 'Works like magick!' " -duplicate 1,-2-1 -set delay 1 -set dispose previous -layers OptimizePlus -quiet -loop 0 c:\finalImages\final.gif
and the text appeared over the whole gif, so I'm stumped as to what to do to get an image to appear as the watermark.
Any help is appreciated.

Re: Resizing, Cropping & Converting a series of Images to Patrol Cycle Animated GIF + adding Watermark

Posted: 2016-01-22T21:29:09-07:00
by GeeMack
funkyavocado wrote:I have a series of images that I want to convert to an animated gif that plays forwards and backwards. In the process I also want to resize and crop them. I'd like the animated gif to have a watermark.
I'm using "ImageMagick 6.9.3-1 Q16 x64" on Windows 7 64, so for my test I transposed your backslashes to carets for the escape and continued line character. It should work just the same with your backslashes. So taking your first example pretty much exactly as you wrote it...

Code: Select all

convert c:\sourceImages\*.jpg -resize "600x400^" -gravity center -crop 600x400+0+0 +repage \
   -coalesce -duplicate 1,-2-1 -set delay 1 -set dispose previous -layers OptimizePlus -quiet \
   -loop 0 c:\finalImages\final.gif
... and adding a line between "+repage" and "-coalesce" like this...

Code: Select all

convert c:\sourceImages\*.jpg -resize "600x400^" -gravity center -crop 600x400+0+0 +repage \
   null: \( watermark.jpg -resize 64x64 \) -gravity southeast -geometry +20+20 -layers composite \
   -coalesce -duplicate 1,-2-1 -set delay 1 -set dispose previous -layers OptimizePlus -quiet \
   -loop 0 c:\finalImages\final.gif
I get a slide show with a 64x64 version of watermark.jpg at +20+20 from the bottom right corner on every slide.

The "null:" separates the list of images already in the stack from the list of images (a single image in this case) in the watermark stack.

The "( watermark.jpg -resize 64x64 )" brings the watermark image into the command and sizes it as needed.

The "-gravity southeast" prepares the watermark composite to work from the lower right corner.

The "-geometry +20+20" defines the location for the watermark at 20 pixels up and left from the corner.

The "-layers composite" adds the watermark.jpg to the corner of each JPG.

Then it continues with your original command just as you wrote it.

Re: Resizing, Cropping & Converting a series of Images to Patrol Cycle Animated GIF + adding Watermark

Posted: 2016-01-22T22:25:06-07:00
by funkyavocado
That worked! Thanks so much.

Re: Resizing, Cropping & Converting a series of Images to Patrol Cycle Animated GIF + adding Watermark

Posted: 2016-04-29T14:36:57-07:00
by funkyavocado
I've actually changed this a bit so that the final output is an .mp4. Is there any way to have the patrol cycle repeat say like 5 times for the mp4? The gif loops, so that's not a problem, but I would like to make the mp4 longer by having the cycle repeat a few times. I've tried -duplicate 5, 2-1 but that doesn't seem to work.

Re: Resizing, Cropping & Converting a series of Images to Patrol Cycle Animated GIF + adding Watermark

Posted: 2016-05-03T04:21:19-07:00
by GeeMack
funkyavocado wrote:I've tried -duplicate 5, 2-1 but that doesn't seem to work.
Can you post the command you're using?

Re: Resizing, Cropping & Converting a series of Images to Patrol Cycle Animated GIF + adding Watermark

Posted: 2016-05-03T09:16:14-07:00
by fmw42
try -duplicate 5,0--1 (you missed the needed extra -). see http://www.imagemagick.org/Usage/basics/#duplicate