将第一帧从 GIF 导出为 PNG
我想你也许可以帮助我:-)
所以我刚刚启动了我的网站,我将在其中上传一些 GIF 并将它们显示在首页上。
截至目前,我使用脚本来显示 .png 文件,当鼠标悬停时,会显示 .gif 文件,您可以单击它,这会将您链接到 .gif 文件。
所以现在我每个 GIF 都有两个文件; xxx.gif 和 xxx_thumb.png ——但是,我希望它能够自动化并考虑一个简单的脚本。
用伪代码表示:
get .gif
rename to 1.gif
if 1.gif taken? rename to 2.gif
get first frame
export first frame as 1_thumb.png
if 1_thumb.png taken? rename to 2_thumb.png
load new picture? (y/n)
if n
exit
if y
start from step 1
这样的东西太棒了——编码有多难? Ruby 或 Python 可以完成这项工作吗?
这可以通过网络应用程序实现吗?然后将 .gif + .png 作为电子邮件发送给我? <-- 还没有必要:-)
感谢您阅读本文!
I thought you maybe could help me out here :-)
So I just launched my website, where I will upload some GIFs and have them displayed on the front page.
As of right now, I use a script to show a .png file, when a mouse is hovered, the .gif shows and you can click on it, which will link you to the .gif file.
So right now I got two files for every GIF; xxx.gif and xxx_thumb.png -- however, I would like this to get automatized and thought of a simple script.
In pseudo code:
get .gif
rename to 1.gif
if 1.gif taken? rename to 2.gif
get first frame
export first frame as 1_thumb.png
if 1_thumb.png taken? rename to 2_thumb.png
load new picture? (y/n)
if n
exit
if y
start from step 1
Something like this would be awesome -- how hard would it be to code? Would Ruby or Python do the job?
Would this be possible with a web app, then send the .gif + .png as an email to me? <-- not necessary yet :-)
Thanks for reading this!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于 Ruby,您可以查看 rmagick 和 此适用于旧版本的 Rails,它会启动您将遵循的过程。
For Ruby you could check out rmagick and while this is for an older version of Rails it starts the process you would follow.