Created
July 27, 2020 15:52
-
-
Save evilpilaf/b3ab64e44fdba3077e9073a53976cddf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public MemoryStream MergeAsAnimation(IReadOnlyList<MemoryStream> images, ImageParametersBase imageParameters) | |
{ | |
var memoryStream = new MemoryStream(); | |
var encoderOptions = new SkGifEncoderOptions { RepeatCount = 0 }; | |
using var encoder = new SkGifEncoder(memoryStream, encoderOptions); | |
foreach (var imageStream in images) | |
{ | |
imageStream.Position = 0; | |
using var image = SKImage.FromEncodedData(imageStream); | |
var frameInfo = new SkGifEncoderFrameInfo | |
{ | |
Duration = 500, | |
TransparentColor = SKColor.Empty | |
}; | |
encoder.AddFrame(image, frameInfo); | |
} | |
memoryStream.Position = 0; | |
return memoryStream; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment