Skip to content

Latest commit

 

History

History

adam-1bit

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

The Making of Adam (24x24 Pixel Punk) from Scratch / Zero Using Pixel Art Designs in the ASCII Text Format - 1-Bit Black & White Edition

Step 1 - Generate 24x24 Attributes From Pixel Art (In ASCII Text Format)

Let's start with the (base) face - in a 1-bit black & white pixel edition:

require 'pixelart'

colors = {
  '.' => 0,           # transparent
  '0' => 'ffffff',    # color 0 - white
  '1' => '000000',    # color 1 - black
}

img = Image.parse( <<TXT, colors: colors )
. . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . 1 1 1 1 1 1 1 . . . . . . . . .
. . . . . . . 1 0 0 0 0 0 0 0 1 . . . . . . . .
. . . . . . 1 0 0 0 0 0 0 0 0 0 1 . . . . . . .
. . . . . . 1 0 0 0 0 0 0 0 0 0 1 . . . . . . .
. . . . . . 1 0 0 0 0 0 0 0 0 0 1 . . . . . . .
. . . . . . 1 0 0 0 0 0 0 0 0 0 1 . . . . . . .
. . . . . . 1 0 0 1 1 0 0 0 1 1 1 . . . . . . .
. . . . . 1 0 0 0 1 0 0 0 0 1 0 1 . . . . . . .
. . . . . 1 0 0 0 0 0 0 0 0 0 0 1 . . . . . . .
. . . . . 1 1 0 0 0 0 0 0 0 0 0 1 . . . . . . .
. . . . . . 1 0 0 0 0 0 1 1 0 0 1 . . . . . . .
. . . . . . 1 0 0 0 0 0 0 0 0 0 1 . . . . . . .
. . . . . . 1 0 0 0 0 0 0 0 0 0 1 . . . . . . .
. . . . . . 1 0 0 0 0 1 1 1 0 0 1 . . . . . . .
. . . . . . 1 0 0 0 0 0 0 0 0 0 1 . . . . . . .
. . . . . . 1 0 0 0 0 0 0 0 0 1 . . . . . . . .
. . . . . . 1 0 0 0 1 1 1 1 1 . . . . . . . . .
. . . . . . 1 0 0 0 1 . . . . . . . . . . . . .
. . . . . . 1 0 0 0 1 . . . . . . . . . . . . .
TXT

img.save( "./i/attributes/face.png" )
img.zoom(4).save( "./i/attributes/[email protected]" )

Voila!

4x

Let's add a hair-do attribute. Note: Let's place all attributes in a 24x24 canvas (for easier image composition):

hair = Image.parse( <<TXT, colors: colors )
. . . . . 1 . . . . 1 . . . . . . .
. . . . 1 1 1 1 1 1 1 1 1 1 1 . . .
. . . . 1 1 1 1 1 1 1 1 1 1 1 1 . .
. . 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 .
1 . . 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 .
. . 1 1 1 1 1 1 . . 1 . 1 . 1 . . .
. . 1 1 . . 1 . . . . . . . . . . .
. 1 1 1 . . . . . . . . . . . . . .
. 1 1 . . . . . . . . . . . . . . .
. . 1 . . . . . . . . . . . . . . .
. . 1 . . . . . . . . . . . . . . .
. 1 . . . . . . . . . . . . . . . .
TXT
img = Image.new( 24, 24 )
img.compose!( hair, 2, 2 )   # place in 24x24 canvas (image) with x/y offset

img.save( "./i/attributes/hair.png")
img.zoom(4).save( "./i/attributes/[email protected]")

Voila!

4x

Let's add a laser eyes attribute:

lasereyes = Image.parse( <<TXT, colors: colors )
. . . . 1 . . . . . 1 . . . .
. . . . 1 . . . . . 1 . . . .
. . . 1 1 1 . . . 1 1 1 . . .
1 1 1 1 0 1 1 . 1 1 0 1 1 1 1
. . . 1 1 1 . . . 1 1 1 . . .
. . . . 1 . . . . . 1 . . . .
. . . . 1 . . . . . 1 . . . .
TXT
img = Image.new( 24, 24 )
img.compose!( lasereyes, 5, 8 )   # place in 24x24 canvas (image) with x/y offset

img.save( "./i/attributes/lasereyes.png")
img.zoom(4).save( "./i/attributes/[email protected]")

Voila!

4x

Step 2 - All-Together Now - Generate 24x24 Pixel Punk From Attributes

Let's put together Adam on transparent background:

punk = Image.new( 24, 24 )   # canvas (image) with transparent background color
punk.compose!( Image.read( "i/attributes/face.png" ))
punk.compose!( Image.read( "i/attributes/hair.png" ))
punk.compose!( Image.read( "i/attributes/lasereyes.png" ))

punk.save( "./i/adam.png" )
punk.zoom(4).save( "i/[email protected]")
punk.zoom(8).save( "i/[email protected]")

Voila!

4x 8x

Bonus - Try some variants - flip (horizontally):

punk.flip.save( "./i/adam_flipped.png" )  ## flip horizontally
punk.flip.zoom(4).save( "i/[email protected]")
punk.flip.zoom(8).save( "i/[email protected]")

Voila!

4x 8x

Or left is the new right:

punk.mirror.save( "./i/adam_left.png" )
punk.mirror.zoom(4).save( "i/[email protected]")
punk.mirror.zoom(8).save( "i/[email protected]")

4x 8x

That's it. Now create your own Adam (or Eve). Yes, you can.

Questions? Comments?

Post them on the CryptoPunksDev reddit. Thanks.