# Hexpixel Code

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

## Introduction

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

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

* Open Notepad or another text editor.
* Open a small image using a bitmap graphics editor, preferably MS Paint.

### Establishing version info

* Type the following into your text editor: HPC

### Adding image dimensions

* Find the dimensions of your image (width and height).
* 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 -.
* 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

Read the following instructions to learn how to properly add pixels (in hex triplets) to your text.
* Add | to the text (to commence the start of pixels).
* Add HC1,HC2,HC3 etc. to your text.
* 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.
* Replace HC2, HC3, etc. the same way you did with HC1 above.
* Delete the #s in the text.
* 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

Transparency is available in HPC, to an extent.

### Complete transparency

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

### Partial transparency

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

Read the following instructions to learn how to properly create animated image files.
* If you have an animated image, after the WIDTHxHEIGHT in the text, add a period ..
* After the ., add the number of frames your animated image has.
* 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.
* 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

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

### Assigning variables

* If you use a pixel such as F03826 more than once, you can assign a variable for it.
* 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

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

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:
Here are all of the other preassigned one-character variables:

#### Preassigned two-character variables

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:

#### Preassigned three-character variables

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:

#### Preassigned five-character variables

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:
^ 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:
! is used to repeat the character before the symbol as many times until the end of the six characters. Examples:

## Consecutives

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

### Consecutive pixels and variables

* 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.
* 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

* 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:
then you can put your three conlines:
* 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.
* Note that a variable is not needed and can be done with brackets:
The @ character denotes a skip to a certain set of coordinates to assign pixel.
Eg:

## Examples

Below are examples to help you.

### Examples images
#### Hi.HPC
##### Image
#### Smiley.HPC
##### Image
## Authors

* Domthedude001, first author of this Wikibook and creator of the Hexpixel Code.
* All of the other contributors.