0
点赞
收藏
分享

微信扫一扫

蓝桥杯每日真题 - 第7天

王远洋 2024-11-18 阅读 10

最近喜欢上了一款像素风的游戏,然后想着用R写一个简单的将图片转为像素风格的代码😂。

先读入图片的像素矩阵,通过采样减少像素的数量,得到的新表格用ggplot直接画出来,效果还不错,用geom_tile是直接的像素,用geom_point画出来像拼豆一样,函数放在plot4fun包里面了:

• 安装:

devtools::install_github("Asa12138/plot4fun")

• 运行:

library(plot4fun)
pixel_plot("https://stardewvalleywiki.com/mediawiki/images/b/b2/Animals_Icon.png")
pixel_plot("https://static.vecteezy.com/system/resources/previews/008/386/721/original/cartoon-funny-cat-isolated-on-white-background-vector.jpg",size = 64,geom = "tile")

在这里插入图片描述

举报

相关推荐

0 条评论