使用 C#、ASP.net 创建带有图像转换的 Gif

发布于 2024-12-08 10:21:47 字数 242 浏览 4 评论 0原文

我有一个要求,我有很多图像,并且需要创建具有各种图像过渡的幻灯片放映,并且我应该能够将其与图像过渡一起保存为 gif 文件。

我能够在 C# 中创建图像之间的各种过渡,但尚未找到如何将其另存为 gif。有一个组件 NGif 允许创建包含多个图像的 gif。我尝试在每次转换时保存图像,然后创建所有这些图像的 gif,但它不显示转换效果,而仅显示接下来在不同转换级别显示的具有黑色背景的图像。

有没有办法创建具有图像之间过渡效果的 gif?

I have a requirement where I have many images and need to create a slide show with various image transitions and I should be able to save it as a gif file along with image transitions.

I am able to create various transitions between the images in C# but not yet found out how to save it as a gif. There is a component NGif which allows to create a gif with multiple images. I tried to save the image at every trasition and then create a gif of all these images but it does not show the transtion effect but shows only the image to be shown next at different transition level with black backgroud.

Is there a way to create a gif with transition effects between the images?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

断念 2024-12-15 10:21:47

我的目标是创建一个可以创建动画 GIF 的库。它必须基于 .NET 或 COM 才能轻松使用。也许类似于 CodeProject 上的此项目

I would aim for a library that creates animated GIF. It either has to be .NET or COM based to easily use. Perhaps something like this project at CodeProject.

酷炫老祖宗 2024-12-15 10:21:47

GIF 不支持 Alpha 通道的透明度。唯一支持的透明度是完全透明度(不是像 Alpha 通道那样的不透明度级别)。您需要将调色板条目指定为透明颜色,然后在需要透明度的地方使用该调色板条目(GIF 始终与调色板一起保存)。

在动画 GIF 中,下一张图像叠加在上一张图像上,因此透明区域显示上一张图像。

或者,您可以只渲染整个新图像而不依赖透明度。

GIF doesn't support transparency with an alpha channel. The only transparency supported is full transparency (not an opacity level like with an alpha channel). You need to designate a palette entry as the transparent color, and then use that palette entry where you want transparency (GIF is always saved with a palette).

In animated GIF, the next image is overlaid on the previous one, so transparent areas show the previous image.

Alternatively, you could just render the entire new image and not rely on transparency.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文