<commit_before># msg2img
A JavaScript browser module for encoding arbitrary data into a PNG image


## Build
*NOTE:* The module in msg2img.js is ready to be used in RequireJS environments. If you want to use it without an AMD capable system, use the msg2img_standalone.js file and load it via `<script>` tag.

The standalone module was built using browserify as follows:

```bash
npm install browserify
browserify -e msg2img.js -s msg2img -o msg2img_standalone.js
```

## Usage
Please note that the `encode` function takes an `ÀrrayBuffer` object and returns the data URL of the generated PNG image. The `decode` function works just the other way around.

```bash
var msg2img = require("msg2img");
var msg = "Hello there, I am in the image!";
var msgArr8 = new Uint8Array(msg.length);
for (var i = 0; i < msg.length; i ++)
  msgArr8[i] = msg.charCodeAt(i);
var imgDataURL = msg2img.encode(msg);
msgArr8 = new Uint8Array(msg2img.decode(msgDataURL));
msg = msgArr8.apply(null, String.fromCharCode);
```

## Tests
Coming soon. For now, just read the sources, they are short and easy to understand.<commit_msg>README used wrong language for code block<commit_after># msg2img
A JavaScript browser module for encoding arbitrary data into a PNG image


## Build
*NOTE:* The module in msg2img.js is ready to be used in RequireJS environments. If you want to use it without an AMD capable system, use the msg2img_standalone.js file and load it via `<script>` tag.

The standalone module was built using browserify as follows:

```bash
npm install browserify
browserify -e msg2img.js -s msg2img -o msg2img_standalone.js
```

## Usage
Please note that the `encode` function takes an `ÀrrayBuffer` object and returns the data URL of the generated PNG image. The `decode` function works just the other way around.

```javascript
var msg2img = require("msg2img");
var msg = "Hello there, I am in the image!";
var msgArr8 = new Uint8Array(msg.length);
for (var i = 0; i < msg.length; i ++)
  msgArr8[i] = msg.charCodeAt(i);
var imgDataURL = msg2img.encode(msg);
msgArr8 = new Uint8Array(msg2img.decode(msgDataURL));
msg = msgArr8.apply(null, String.fromCharCode);
```

## Tests
Coming soon. For now, just read the sources, they are short and easy to understand.
{'fraction_non_alphanumeric': 0.09260908281389137, 'fraction_numerical': 0.015138023152270703, 'mean_word_length': 4.717557251908397, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3882345', 'n_tokens_mistral': 714, 'n_tokens_neox': 682, 'n_words': 305}