Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I am trying to merge a static background with a GIF created using GAP in GIMP
#1
Greetings everyone,

I found this thread...
https://graphicdesign.stackexchange.com/...imated-gif

Many find the solution working.But i can't find Multi Layer Merge extension anywhere on the web.Does anyone have the extension?Could you please share it with me?

I am using Windows 8,GIMP 2.10.8.

regards,
Techie1484
Reply
#2
You can get it from the internet archive: (In case you have problems with that, I will attach) 

https://web.archive.org/web/201509060156...rger_0.zip

The usual, unzip put in : C:\Users\your-name\AppData\Roaming\GIMP\2.10\scripts

Seems to work ok in Gimp 2.10 https://i.imgur.com/FWyaabu.jpg

All the advice for animations apply:
If needed unoptimise the animation
Set the animation (and new background) to RGB mode.

Alternatives: 
Ofnuts interleave-layers-0.4.py plugin well down the page here (about 45 down)
https://sourceforge.net/projects/gimp-to...s/scripts/
or 
If you need a larger background than the animation this one: http://chiselapp.com/user/saulgoode/repo...combine-bg


Attached Files
.zip   multi-layers-merger_0.zip (Size: 2.03 KB / Downloads: 18)
Reply
#3
Thank you for the quick reply,share and alternative solutions.The Script fus installed smoothly and am trying different options as suggested.

regards,
Techie1484
Reply
#4
I used interleave layers plugin and I got the desired results.

[Image: chris_redfield_final_1.gif]

Thank you,again,for alternate suggestions.
Reply
#5
(11-18-2018, 07:51 PM)techie1484 Wrote: I used interleave layers plugin and I got the desired results.

[Image: chris_redfield_final_1.gif]

Thank you,again,for alternate suggestions.

Hi, I am trying to do something very similar to what you have done here, where I am underlaying an GIF on a static image within a selected region. I have tried the multi-layer merger, but cannot get it only within the selected region i want it (in your case this would be within the mirror frame), did you use the Ofnuts interleave-layers-0.4.py plugin, if so how do you execute this? I am relatively new to GIMP so I am not familiar with all the the commands/controls. Any detailed explanation would be appreciated.
Reply
#6
With interleave-layers, both images must have the same width and height, so you likely want to use Image>Canvas size on the animation. Once you have positioned the animation in the canvas, you can use ofn-layers-to-image-size (same place as interleave-layers) to make the layers fill the whole canvas.

Then to produce the image above, two possibilities:

1) the fixed part has a transparent hole, you insert it in "title" mode in the animation image (fixed image copied over each frame of the animation)

2) the animation is restricted to a circle and all the layers are transparent outside of the circle, you insert the fixed image in "sprite" mode in the animation.
Reply
#7
Sorry for the late reply.I will explain how i got this result:

[Image: giphy.gif]

First i prepared the static layer which looks like below:

[Image: RE-5-Chris-redfield-500-layer-mask.png]

In the circular area,I have simply used ellipse tool and resized it to fit the circular region.If you only use mouse pointer to find pixel perfect circumference,it can be hard.So initially to make an approximate region,use mouse.Then when getting closer to circumference,without clicking or dragging,hover mouse pointer to edges of circular region within the ellipse region and we can find a box shaped highlighted region indicating that particular region can be moved pixel by pixel using arrow keys.That way,you can ensure pixel perfect circular selection.

Transparency:

If we have multiple layers in an image and even if we merged all layers into one layer,transparency of individual layers will still be preserved and simply cutting out the region will not give 100 % transparency in that region.We still can see some non-transparent region in the below image:

[Image: RE-5-Chris-redfield-500.png]

To achieve 100% transparency,we need to add layer mask.

Layer mask explained here:

https://www.gimp.org/tutorials/Layer_Masks/

So to achieve 100% transparency in the circular region as per the image i have shown,

1)On the final merged layer,we need to add a layer mask as described in the tutorial shown above.For eg: On the layers window(docked on the right side of GIMP screen),right click on it.Select "Add layer mask".From the options that are shown in the following dialog,Choose white(full opacity).In the layers window,beside the final merged layer thumbnail,you will find a full white layer thumbnail(which is just a mask).By default,the mask will be the active selection.For some reason,if you have selected the layer thumbnail,click once on the mask thumbnail to make it active.

2)Perform the same elliptical selection as done earlier to make a circular region to fit the animation frames.Fill the foreground color with black as suggested in Layer mask tutorial i linked above.

By now,I hope people have downloaded interleave layer plugin as suggested in previous posts.Simple perform,Image->Interleave layers->Interleave stack of layers. In the drop down list,we will have to select jus the one merged layer name and specify blend mode.In this example,I have chosen "screen" option.

Layer blend modes explained here(with previews):
https://docs.gimp.org/en/gimp-concepts-layer-modes.html

Now we will have a single final layer that can be interleaved on top of all frames of the animation.Save the file as .xcf file(It can be exported as .png file and can still be interleaved on top of frames,but i am not sure of how much the final file would be effected as .png.So for the sake of this example,we will save the final merged layer as .xcf file)

Some topics on animation:

1)I observed that changing the image mode(Menu short cut= Image menu -> mode ->indexed) to indexed gives a good quality GIF.But as per this example,I have chosen greyscale.But if anyone wants to preserve all the colors used in an animation,indexed needs to be chosen.

Indexed mode options explained here:

https://docs.gimp.org/2.10/en/gimp-image...dexed.html

So for animation,in Dithering option,Best suited would be "Positioned" dithering.In simple terms,When merging static layers with animation frames,the result of both static layer and animation frame may look some-what botched(as is in my case).So the right dithering option for animation(as suggested in link above) is "positioned".Dithering is further explained in the link i have given above.

2)Resizing the animation frames.We don't have to resize every frame but can be collectively resized when selecting the menu option Image -> Scale image.

Interpolation method i used in this example is Nohalo.

As per my example,To fit my animation frames in the transparency region that i made in the above example,the size requires to be 178 x 178 pixels. But when extracting frames from a video, the aspect ratio seems to fixed to 16:9. So it was only possible to make the height to 178 pixels,the length will be automated to fit 16:9 aspect ratio(which is longer in width to 178 pixels).But we can crop the unwanted width and achieve 178 x 178 pixel dimensions.

To achieve a centered positioned crop(instead of using crop tool which may crop some pixels unintentionally),we can achieve a centered and justified crop if done as below:

1)Perform File ->New.In the layer dimensions,give width=178 and height=178(in pixels)
2)Perform File->open as layers->(select .xcf file which has animation frames).
3)Perform (In the menu bar as same as "File")Filters->Animation->Unoptimize.

The above should crop the width on the left and right equally.Save the xcf file.(I have installed all the plugins such as combine background layer and multi-layer merger plugins,so if the above result is not achieved,please install the plugins and perform above steps).

Now we have both animation frames and one static layer to be interleaved on top of all the frames.To execute interleave layer plugin,the requirement is that the dimensions of the static layer and the dimension of animation frames need to be the same(not even a pixel difference in width and height dimensions).Also,as per this example,we need to find the relative position of all frames to fall in the transparent region of the static layer.

This can be achieved as follows:

1)Open a new canvas with dimensions relatively larger to fit both animation frames and static layer.In my example,My final animation dimensions are 500 X 295(pixels).As per my static layer,frames need to be relatively on the left,so i would choose a much larger width than 500.Say for example 800(can be longer than 800,its jus arbitrary).So the length of new canvas is 800.The height can be relatively smaller since my entire height of animation frame(178) does fit in my static layer height which is 295.But for sake of relative positioning,I choose 300(again,its arbitrary for relative positioning of animation frames).So my final dimensions of a new canvas is 800 x 300.

2)Perform File->open as layers->open .xcf file with animation frames.This will open all frames in centered position.Perform File ->Open as layers->(Static image that needs to be interleaved on top of animation frames).Now this will also be positioned centered on the current canvas.

3)Select the static layer(by left mouse click) on the docked layer window which now has both animation frames and static layer without any positioning.Select move tool.

Move tool explained here,

https://docs.gimp.org/2.10/en/gimp-tool-move.html

As done before we will not need mouse to move the static layer but use arrow keys to acquire pixel perfect positioning.Use shift + arrow keys to move 25 pixels in the right direction and to move it pixel by pixel,use only arrow keys.

On the canvas,we will be able to see one of the frames of the animation and the static layer.Move the static layers using arrow keys and position the static layer so as the animation frame falls exactly in the transparent region of static layer(please zoom in and verify for any pixel level differences which will sometimes go unnoticed at jus 100 % of canvas and layer dimensions).Now we will crop the canvas which will fit,the dimensions of the static layer which is 500 x 295.Select the crop tool  and perform a selection that approximately fits the static layer dimensions(500 X 295).As done with ellipse tool earlier in our example,hover the mouse pointer towards the lengths and that particular portion will be highlighted.Use arrow keys to move pixel by pixel.On the left side of GIMP screen,We will find the dimensions of the current crop region.Relatively use arrow keys to extend the crop layer pixel by pixel and its result dimension can be seen on the docked window on the left side of GIMP screen.Ensure the crop dimensions(as per the example) is 500 X 295.Once the crop region is finalized, perform a click inside the crop region.Now we have a relative position for the animation frames that needs to fall under the transparent area of the static layer.

Perform (From menu bar that has "File"),Select Filters->Animation->Unoptimize.

This will resize the animation frames as same as the static layer(in our example,500 X 295) and relatively position the animation frames.We can delete the static layer which we used for relative positioning of frames and the background layer of current canvas.Save the result into .xcf file.

Now all thats left to do is interleave the static layer on top of all animation frames.

Perform File->open as layers->(.xcf file with Unoptimized animation frames with relative positioning which was saved jus before this step).
Perform File->Open as layers -> .xcf file Static layer(with layer mask transparency of dimension 500 x 295)
Perform image ->Interleave layers->Interleave single layer(title mode).

In the result,we will need to choose the layer which needs to interleaved on top of other animation frame layers.Click on the drop down to view the different layers.It will be of format <New file>/<current file-layer>.Choose the static layer which will have the unique name as the static layer was saved as a .xcf file.Presumably,It will be at the bottom most of the drop down.Select it by left click.

Select a blend mode option.(Blend mode options explained with preview.    https://docs.gimp.org/en/gimp-concepts-layer-modes.html)


Choose opacity.In this example,I have choosen 100 %.

Then give submit/done button.

If the execution was successful , in the layer window docked on the right side of GIMP screen,the thumbnail of each frame will have the static layer on top of it.

Delete any unwanted layers which don't contribute to animation.(possible if a new canvas is used).

File - > export as -> <file name>.gif

Choose save as animation,give delay between frames.Default being 100 milliseconds. Typically, Videos supposedly run at 60 frames per second. To suit that quality, the delay between frames would be 1/60 of a second = 0.0166666 = 1.66 milliseconds which can be approximated to 2 milliseconds.But the lowest delay possible is 10 milliseconds.

I hope that helps
Reply


Forum Jump: