I'm using Tim Jones's fork of the DynamicImage library on a background task in C#.
Everything works great, with the exception of isolating the layer effects. In the example below the filters from "firstLayer" are also applied to "secondLayer". I need the second layer to be on top but only anchored to the bottom. Both images are PNGs, only "secondLayer" has a transparency. How can I ensure that filters do not affect other layers?
Composition composition = new Composition();
//Create Layer 1 --------------
var firstLayer = LayerBuilder.Image.SourceBytes(firstImageBytes);
//Rotate The Image
firstLayer.WithFilter(FilterBuilder.Rotate.To(180));
//Crop the image
firstLayer.WithFilter(FilterBuilder.Crop.X(50).Y(50));
//Create Layer 2 -----------
var secondLayer = LayerBuilder.Image.SourceBytes(secondImageBytes);
//Add both layers to the composition ---------------
composition.Layers.Add(firstLayer.ToLayer());
composition.Layers.Add(secondLayer.ToLayer());
// Anchor image 2 to the bottom
composition.Layers[1].Anchor = AnchorStyles.BottomCenter;
//Generate The Image
GeneratedImage generatedImage = composition.GenerateImage();
//I then convert the generatedImage to a byte[] and save it to Blob storage.
I've tried many variations on the above code and the filters seem to always affect layers they are not applied to. I am certain that I am missing an important concept. Any thoughts or suggestions?