「这是我参与11月更文挑战的第19天,活动详情查看:2021最后一次更文挑战」。
上一篇文章介绍了静态图转字符的实现demo;接下来也该是动态图转字符的demo了
从前面几篇文章的学习过程中,要想实现这个功能就属于信手拈来了
单张图转字符完成之后,动图无非是每一张静态图都转一遍,保存最后的结果即可
这里我们就不介绍基础的JDK写法了(感兴趣的可以到前面几篇文章中获取),我们直接进入进阶的玩法
接下来我们借助开源项目 github.com/liuyueyi/qu… 来迅速的实现输出Gif字符图
@Test
public void testCharLines() {
String file = "https://c-ssl.duitang.com/uploads/item/201707/11/20170711194634_nTiK5.thumb.1000_0.gif";
java.util.List<java.util.List<String>> list = ImgPixelWrapper.build()
.setSourceImg(file)
.setBlockSize(3)
.setRate(0.6)
.setPixelType(PixelStyleEnum.CHAR_COLOR)
.build()
.asChars();
for (List<String> s: list) {
for (String t: s) {
System.out.println(t);
}
System.out.println("------- 分割 -------");
}
}
复制代码
注意上面的实现,List<String>
表示一个张字符图,一个gif图可以转换成多个
具体的输出字符太多,这里简单截取几个看一看效果
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$$$$$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$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
复制代码
一灰灰的联系方式
尽信书则不如无书,以上内容,纯属一家之言,因个人能力有限,难免有疏漏和错误之处,如发现bug或者有更好的建议,欢迎批评指正,不吝感激
- 个人站点:blog.hhui.top
- 微博地址: 小灰灰Blog
- QQ: 一灰灰/3302797840
- 微信公众号:一灰灰blog