[go: up one dir, main page]

Jump to content

Hexpixel Code

From Wikiversity

Hexpixel Code is an easy-to-use language used to create images in text editors using hex triplets.

Introduction

[edit | edit source]

Hexpixel Code is so-named because it is a language (or code) which uses hex triplets and goes pixel by pixel. With this language, images can be easily created in Notepad.

Starting out

[edit | edit source]

Please read and follow the directions very carefully. Copy and paste code boxes because it is very easy to make a simple typo with character mistakes.

Setting up the workspace

[edit | edit source]
  1. Open Notepad or another text editor.
  2. Open a small image using a bitmap graphics editor, preferably MS Paint.

Establishing version info

[edit | edit source]
  1. Type the following into your text editor:
    HPC

Adding image dimensions

[edit | edit source]
  1. Find the dimensions of your image (width and height).
  2. Add
    -WIDTHxHEIGHT
    to the text (with no spaces). It should look like this:
    HPC-WIDTHxHEIGHT
If you wish to put your width and height (and other numerals in your code) in hexadecimal form, use a ~ instead of a -.
  1. Replace WIDTH with the width of your image and replace HEIGHT with the height of your image.
    If your width was 4 and your height was 3, the code should now, so far, look like this:
    HPC-4x3
You may wish to not include an x by simply removing it and by verifying that when the number of numerals are even and when split in half, will return the say result. Instead, you could also replace the x with a ,.

Starting the pixels and adding them

[edit | edit source]

Read the following instructions to learn how to properly add pixels (in hex triplets) to your text.

  1. Add
    |
    to the text (to commence the start of pixels).
  2. Add
    HC1,HC2,HC3
    etc. to your text.
  3. Replace HC1 with the hex triplet of the first pixel in the first line of your image.
    For example, if the first pixel in the first line was black, you would look it up here (black is #FFFFFF), and you would replace HC1 with #FFFFFF.
  4. Replace HC2, HC3, etc. the same way you did with HC1 above.
  5. Delete the #s in the text.
  6. When you get to the second line of your image, add a semicolon
    ;
    to your text then you may go to the second line of your image.

Transparency

[edit | edit source]

Transparency is available in HPC, to an extent.

Complete transparency

[edit | edit source]

Use T, TT, TTT or TTTTTT or (x being any pixel) x%FF or x%(100) for completely transparent pixels.

Partial transparency

[edit | edit source]

To make a partially transparent pixel, put % after the pixel (but before ending the pixel and any cons), followed by the opacity of the pixel in hexadecimal form (or if parenthesis are present, decimal form).

Animated Images

[edit | edit source]

Read the following instructions to learn how to properly create animated image files.

  1. If you have an animated image, after the WIDTHxHEIGHT in the text, add a period ..
  2. After the ., add the number of frames your animated image has.
  3. After the frames count, add a comma to your text and add the frame rate (in milliseconds) of the animated image - the default is 70 and will be chosen if there are no commas.
  4. After the frame rate, add another comma and then how many times the animated image loops. If it loops infinite times, put 0. If it does not loop, put 1, or do not include this bullet at all.
When separating in between frames, use a period (.).

Variables

[edit | edit source]

Read the following instructions to learn how variables work, and how to properly assign variables to lower the filesize.

Assigning variables

[edit | edit source]
  1. If you use a pixel such as F03826 more than once, you can assign a variable for it.
  2. To shorten a pixel such as F03826 to a variable such as XV, after the WIDTHxHEIGHT and before the |, add
    *XV=F03826
    to your text.

Preassigned variables

[edit | edit source]

The variables below are variables that are preassigned and will be recognized without assigning them. These variables, however are able to be re-assigned with the method above.

Preassigned one-character variables

[edit | edit source]

If there is a hexpixel has the same character (between 0 and F) six times in a row, reduce the pixel by deleting all of the characters and then adding the previously first character only once (make sure a variable is not already assigned). Here are all of its possible outcomes:

0=000000
1=111111
2=222222
3=333333
4=444444
5=555555
6=666666
7=777777
8=888888
9=999999
A=AAAAAA
B=BBBBBB
C=CCCCCC
D=DDDDDD
E=EEEEEE
F=FFFFFF

Here are all of the other preassigned one-character variables:

G=0000FF
H=00FF00
I=00FFFF
J=FF0000
K=FF00FF
L=FFFF00
M=0000CC
N=00CC00
O=00CCCC
P=CC0000
Q=CC00CC
R=CCCC00
S=CCCCCC
T=TTTTTT // Transparant
U=CCCCFF
V=CCFFCC
W=CCFFFF
X=FFCCCC
Y=FFCCFF
Z=FFFFCC

Preassigned two-character variables

[edit | edit source]

If there is a hexpixel has the same character (between 0 and F) three times in a row and a different character (between 0 and F) three times in a row after, reduce the pixel by deleting all of the characters, then add the previously first character only once, and then the previously fourth character only written once (make sure a variable is not already assigned).

Examples:

AC=AAACCC
01=000111
7B=777BBB

Preassigned three-character variables

[edit | edit source]

If there is a hexpixel has the same character (between 0 and F) two times in a row and a different character (between 0 and F) two times in a row after, and yet another character (between 0 and F) written two times in a row after that, reduce the pixel by deleting all of the characters, then add the first character only written once, then the third character only written once and then the fifth character only written once (make sure a variable is not already assigned).

Examples:

ACA=AACCAA
010=001100
DAD=DDAADD

Preassigned five-character variables

[edit | edit source]

If a hexpixel could be a two/three-character variable, but a half/third of the pixel doesn't match, make the variable as normal and for the part the abnormal half/third, write it in full. If the abnormal part is half of the pixel, add a " before the abonormal half, and if it is a third of the pixel, add a ' before the abnormal third.

Examples:

F'09F=FF09FF
F"090=FFF090

^ can be used if a hexpixel repeats itself. Add it to the end of the repeated pixels for them to repeat until the end of the six characters. Examples:

FF2^=FF2FF2
FA^=FAFAFA
FA^B=FAFAFB
FA^BB=FAFABB

! is used to repeat the character before the symbol as many times until the end of the six characters. Examples:

FF2!=FF2222
BA!=BAAAAA
BA!B=BAAAAB
BA!BB=BAAABB

Consecutives

[edit | edit source]

Read the following instructions to learn how to properly assign consecutive pixels/variables (cons).

Consecutive pixels and variables

[edit | edit source]
  1. If you use a pixel or a variable such as F0F8FF, more than once in the same consecutive order, you can shorten it into a conpix.
  2. If you saw a string of pixels (or variables) in an order like this:
    F0F8FF,F0F8FF,F0F8FF,F0F8FF,F0F8FF
    You can shorten the string by deleting those pixels and then adding something like this:
    F0F8FF-5
For each non-conpix you can add a -1 within the pixel (or variable) but this is unnecessary because it increases filesize.
If different pixels appear in between a sequence of consecutives, you may use a $ to represent the consecutives after the different pixels.

Consecutive lines

[edit | edit source]
  1. If you saw a string of pixels (or variables) in an order, like this:
    F0F8FF,0,CADABA,FC0FC0;F0F8FF,0,CADABA,FC0FC0;F0F8FF,0,CADABA,FC0FC0
    you can shorten the string by assigning a variable, example:
*F0F8FF,0,CADABA,FC0FC0=1

then you can put your three conlines:

1+3
  1. When put together, the full text looks something like this:
    HPC-4x3*F0F8FF,0,CADABA,FC0FC0=1|1+3
For each non-conline you can add a +1 within the pixel (or variable) but this is unnecessary because it increases filesize.
If different pixels appear in between a sequence of consecutives, you may use a $ to represent the consecutives after the different pixels.
  1. Note that a variable is not needed and can be done with brackets:
HPC-4x3|{F0F8FF,0,CADABA,FC0FC0}+3

The @ character denotes a skip to a certain set of coordinates to assign pixel.

Eg:

@8,9|FF0000,BC0108,|

Examples

[edit | edit source]

Below are examples to help you.

One line

[edit | edit source]
HPC-3x1|F0F8FF,E32636,FFBF00

Two lines

[edit | edit source]
HPC-3x2|F0F8FF,E32636,FFBF00;F0F8FF,E32636,FFBF00

Variables

[edit | edit source]

One variable

[edit | edit source]
HPC-3x1*1=F0F8FF|1,E32636,FFBF00

Two variables

[edit | edit source]
HPC-3x1*1=F0F8FF*AI=E32636|1,AI,FFBF00

Multivars

[edit | edit source]
HPC-2x1*F0F8FF,E32636=1|1

Animated images

[edit | edit source]

Animated images with loops

[edit | edit source]
HPC-3x1.2,7|F,F0F8FF,FFBF00.0,F0F8FF,FFBF00

Consecutives

[edit | edit source]

Consecutive pixels

[edit | edit source]
HPC-3x1|E32636-3

Consecutive lines

[edit | edit source]
HPC-1x3|E32636+3

Consecutive pixels and lines

[edit | edit source]
HPC-3x3|E32636-3+3
HPC-6x4|E32636-3+4,G-3;$-3,F-3;$-3,0-2,Y;$-3,G,R,F

Examples images

[edit | edit source]

Hi.HPC

[edit | edit source]
HPC-7x3|0,F,0,F,0-3;0-3,F-2,0,F;0,F,0,F,0-3
Image
[edit | edit source]

Smiley.HPC

[edit | edit source]
HPC-12x11|
F-4,0-4,F-4;
F-2,0-2,L-4,0-2,F-2;
F,0,L-8,0,F;
F,0,L-2,0-2,L-2,0-2,L,0,F;
0,L-3,0,L-2,0,L-3,0;
0,L-10,0;
0,L-2,0,L-4,0,L-2,0;
F,0,L-2,0-4,L-2,0,F;
F,0,L-8,0,F;
F-2,0-2,L-4,0-2,F-2;
F-4,0-4,F-4
Image
[edit | edit source]

Authors

[edit | edit source]