百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
P

punks.starter

> 编程语言
开源

DIY (Do-It-Yourself) - 是的,你可以! 像素艺术集快速入门 - 以算法生成自己的精选 (或随机) 集合

195 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

DIY (Do-It-Yourself) - 是的,你可以! 像素艺术集快速入门 - 以算法生成自己的精选 (或随机) 集合

Note: See /punks.whitelabel - The Free White Label Punk Quick Starter Edition - if you want to (re)create from zero / scratch a pixel-perfect copy of the Matt & John's® 10 000 punks collection (anno 2017).


Pixel Art Collection Quick Starter - Generate Algorithmically Your Own Curated (or Randomized) Collection

Table of Contents / Sample Collections

Collection №1 - Twenty-Five Dodge Pixel Art Punks

Collection №2 - The First One Hundred Pixel Art Punks

Collection №3 - The First One Hundred Pixel Art Punks - The Black & White (Pencil Drawing) Sketch Edition

Collection №4 - 111 Cool Blue Aliens (Incl. Females & Super-Rare Apes)


Let's start and generate algorithmically a pixel art collection in three steps:

Step 1 - Generate A List of Your Pixel Art Collection in a Tabular Text Format (Spreadsheet)

Step 2 - Generate All Pixel Art Images in Original Format and In 20x

Step 3 - Bonus: Generate an All-In-One Composite Image

Collection №1 - Twenty-Five Dodge Pixel Art Punks

Let's start with an exclusive twenty-five Shiba Inu dogs pixel art collection. Much wow. Super rare.

Let's copy and (re)use all punk (building) blocks in the dodge series (24×24):

Classic , Dark , Zombie , Alien

Attributes (by category and a-z):

  • Hat - Bandana , Beanie , Cap , Cap Forward , Cowboy Hat , Fedora , Headband , Knitted Cap , Tiara , Top Hat
  • Hair - Crazy Hair
  • Eyes - 3D Glasses , Big Shades , Classic Shades , Eye Patch , Nerd Glasses , Regular Shades , Small Shades

(Source: Punk (Building) Blocks - Dodge Series (24×24))

Step 1 - Generate A List of Your Pixel Art Collection in Tabular Text Format (Spreadsheet)

In the first sample let's generate the list of the pixel art collection by hand. Let's use a rarity & popularity distribution of 10 classic Shibas, 7 darkies, 5 zombies and 3 aliens. Example - dodge.csv:

…

Yes, that's it. For the list format let's use the comma-separated values (.CSV) format supported by all spreadsheet programs. Every line is a record of a punk made up of the original type and one or more attributes.

Note: Let's NOT add the index number (0,1,2,3, and so on). Why? That way you can easily reshuffle your collection anytime. Let's try a more "random" look by hand:

…

Step 2 - Generate All Pixel Art Images in Original Format and In 20x

Now the "magic" let's read in the list in the comma-separated values (.CSV) format and generate all pixel art images in the original format (24×24) and in 20x (480×480).

ruby
require './boot'

recs = read_csv( './no1/dodge.csv' )
puts "  #{recs.size} punk(s)"
#=>  25 punk(s)

art = Art.new( dir: './dodge' )

recs.each_with_index do |rec,i|
  name = "punk#{i}"
  punk = art.generate( rec )

  punk.save( "./o/no1/#{name}.png" )
  punk.zoom(20).save( "./o/no1/#{name}@20x.png" )
end

Yes, that's it. Run the script to generate algorithmically your collection.

In the /o directory you will now find two images per punk - in the orginal format, that is, 24×24 and 20x, that is, 480×480 - and get:

no1/
  punk0.png
  [email protected]
  punk1.png
  [email protected]
  punk2.png
  [email protected]
  punk3.png
  [email protected]
  punk4.png
  [email protected]
  punk5.png
  [email protected]
  punk6.png
  [email protected]
  punk7.png
  [email protected]
  punk8.png
  [email protected]
  ...

Let's open up punk0.png to punk24.png:

And let's have a looksie at the biggie 20x (480×480) versions:

[...]

Note: If you use your own artwork make sure your type and attribute names used in the list in the comma-separated values (.CSV) format match the filenames (without the .png extension). For the matching algorithm all names get automatically downcased and all spaces deleted, thus, Classic will map to classic.png and 3D Glasses to 3dglasses.png and Knitted Cap to knittedcap.png and so on.

Step 3 - Bonus: Generate an All-In-One Composite Image

Let's generate an all-in-one composite image holding the complete collection in a 5×5 grid.

…

Note: The attributes (see above) come in two editions, that is, m - male (stored in the /m directory) and f - female (stored in the /f directory). To map the attribute (or "qualify" the name with an extra auto-added directory) let's configure the "qualifier" by archetype, that is, Male 1/2/3/4, Zombie, Ape and Alien will auto-add the /m directory to the attribute image lookup and Female 1/2/3/4 will aut-add the /f directory.

Yes, that's it. Run the script to generate algorithmically your collection.

In the /o directory you will now find two images per punk - in the orginal format, that is, 24×24 and 20x, that is, 480×480 - and get:

no2/
  punk0.png
  [email protected]
  punk1.png
  [email protected]
  punk2.png
  [email protected]
  punk3.png
  [email protected]
  punk4.png
  [email protected]
  punk5.png
  [email protected]
  punk6.png
  [email protected]
  punk7.png
  [email protected]
  punk8.png
  [email protected]
  ...

Let's open up punk0.png to punk99.png:

And let's have a looksie at the biggie 20x (480×480) versions:

[...]

Step 3 - Bonus: Generate an All-In-One Composite Image

Again let's generate an all-in-one composite image holding the complete collection in a 10×10 grid.

…

What's different from Collection №2 - The First One Hundred Pixel Art Punks?

Two new achetypes, that is, Alien Ape and Alien Female in the qualifier setting / configuration. Yes, that's it. Run the script to generate algorithmically your collection.

In the /o directory you will now find two images per punk - in the orginal format, that is, 24×24 and 20x, that is, 480×480 - and get:

no4/
  punk0.png
  [email protected]
  punk1.png
  [email protected]
  punk2.png
  [email protected]
  punk3.png
  [email protected]
  punk4.png
  [email protected]
  punk5.png
  [email protected]
  punk6.png
  [email protected]
  punk7.png
  [email protected]
  punk8.png
  [email protected]
  ...

Let's open up punk0.png to punk110.png:

And let's have a looksie at the biggie 20x (480×480) versions:

[...]

And open up punks.png for the all-in-one composite:

To be continued...

Appendix

Frequently Asked Questions (F.A.Qs)

Q: Can I use a different pixel format for the collection e.g. 16×16 (instead of the classic 24×24)?

A: Yes, it works with any square pixel size (e.g. 16×16, 24×24, 32×32). Note: If you use the CompositeImage the default width × height is set to 24 × 24 - if you use a different size you have to pass in width and height e.g.

ruby
# 5×5 grid with every tile 16×16
composite = CompositeImage.new( 5, 5, width: 16, height: 16 )

Q: I am trying to make a composite of 30 variations with a base size of 125×125 px each. I can't seem to figure out how to adjust the settings to make it generate a composite without all of the results overlapping each other. Any ideas?

The CompositeImage defaults to width: 24, height: 24, thus, if you use a different dimension / canvas you have to pass along the "custom" width and height. Example with a 10×3 grid (equal to 30 tiles / variations) and 125×125 width x height:

ruby
composite = CompositeImage.new( 10, 3, width: 125, height: 125 )

Q: Is it possible to have more attributes, that is, seven instead of the five used in the sample collection №2?

Yes, you can use as many attributes as you like (no limit really other than the computer processing power and memory) for the scripts / collections.

If you want to use seven attributes - add two more attributes to the tabular dataset - change:

type, attribute1, attribute2, attribute3, attribute4, attribute5
Female 2, Earring, Blonde Bob, Green Eye Shadow
...

to

type, attribute1, attribute2, attribute3, attribute4, attribute5, attribute6, attribute7
Female 2, Earring, Blonde Bob, Green Eye Shadow
...

That's it. By the way - the column names are "arbitrary", that is, yes you can use any name e.g. try hair, eyes, mouth, neck or such instead of attribute1, attribute2, etc.

Troubleshooting

Q: I cannot get the ./generate.rb script to run [in Powershell / in Sublime / in ...]?

A: Make sure you run the script in the "top-level", that is, /punks.starter and you use no1/generate.rb or no2/generate.rb or no3/generate.rb:

/punks.starter
   boot.rb
   /no1
      dodge.csv
      generate.rb
   /no2
      punks.csv
      generate.rb
   /no3
      punks.csv
      generate.rb

And run inside the /punks.starter directory:

$ ruby no1/generate.rb          # start in /punks.starter

Questions? Comments?

Post them on the D.I.Y. Punk (Pixel) Art reddit. Thanks.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Ruby24px24x24cryptopunkspixelart

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言