From 4a8296134932daf797a521802746d53eca9dec44 Mon Sep 17 00:00:00 2001 From: javl Date: Wed, 29 Mar 2023 14:28:38 +0200 Subject: [PATCH 1/3] typo --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 946fb8d..e1bb8dc 100644 --- a/index.html +++ b/index.html @@ -449,7 +449,7 @@ - + From 0e7188900804b3399260a80a155766b644e9f8d2 Mon Sep 17 00:00:00 2001 From: javl Date: Mon, 1 May 2023 17:55:23 +0200 Subject: [PATCH 2/3] add option to hide ', 0x' from plain bytes output --- index.html | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index e1bb8dc..a7e9a2b 100644 --- a/index.html +++ b/index.html @@ -453,6 +453,14 @@ + +
+
+
+ + +
+
@@ -508,11 +516,16 @@ if(byteIndex < 0){ var byteSet = bitswap(number).toString(16); if(byteSet.length == 1){ byteSet = "0"+byteSet; } - var b = "0x"+byteSet; - output_string += b + ", "; + if (!settings.removeZeroesCommas) { + output_string += "0x" + byteSet + ", "; + } else { + output_string += byteSet; + } output_index++; if(output_index >= 16){ - output_string += "\n"; + if (!settings.removeZeroesCommas) { + output_string += "\n"; + } output_index = 0; } number = 0; @@ -724,6 +737,7 @@ backgroundColor: "white", scale: "1", drawMode: "horizontal", + removeZeroesCommas: false, threshold: 128, outputFormat: "plain", invertColors: false, @@ -766,6 +780,7 @@ var caption = document.getElementById("format-caption-container"); var adafruitGfx = document.getElementById("adafruit-gfx-settings"); var arduino = document.getElementById("arduino-identifier"); + var removeZeroesCommasContainer = document.getElementById("remove-zeroes-commas-container"); for(var i = 0; i < caption.children.length; i++) { caption.children[i].style.display = "none"; @@ -773,7 +788,14 @@ caption = document.querySelector("div[data-caption='" + elm.value + "']"); if(caption) caption.style.display = "block"; - elm.value != "plain" ? arduino.style.display = "block" : arduino.style.display = "none"; + if (elm.value != "plain") { + arduino.style.display = "block"; + removeZeroesCommasContainer.style.display = "none"; + settings.removeZeroesCommas = false; + } else { + arduino.style.display = "none"; + removeZeroesCommasContainer.style.display = "table-row"; + } elm.value == "adafruit_gfx" ? adafruitGfx.style.display = "block" : adafruitGfx.style.display = "none"; settings["outputFormat"] = elm.value; From e03e63a8bc13ecfe66e8b100658cded82f23a990 Mon Sep 17 00:00:00 2001 From: javl Date: Mon, 1 May 2023 17:58:50 +0200 Subject: [PATCH 3/3] convert indentation to spaces --- index.html | 2862 ++++++++++++++++++++++++++-------------------------- 1 file changed, 1431 insertions(+), 1431 deletions(-) diff --git a/index.html b/index.html index a7e9a2b..ad1acba 100644 --- a/index.html +++ b/index.html @@ -1,1482 +1,1482 @@ - - image2cpp + + image2cpp - + h1{ + padding: 10px; + color: white; + background-color: #00cb99; + } + -
-
-

image2cpp

-

image2cpp is a simple tool to change images into byte arrays (or your array back into an image) for use with Arduino and (monochrome) displays such as OLEDs. - It was originally made to work with the Adafruit OLED library. An example sketch for Arduino and this library can be found here.

-

More info (and credits) can be found in the Github repository. This is also where you can report any issues you might come across.

-

This tool also works offline. Simply save this page to your computer and open the file in your browser.

-

- Did you find this tool useful? Feel free to support my open source software:
- - GitHub Sponsor - -

-
- -
-
-
-

1. Select image

-
-
-
-

or

-
-
-

1. Paste byte array

-
-
- x - px -
- - -
-
-
- -
-

2. Image Settings

-
-
- -
-
-
-
    -
    Only images file type are allowed
    -
    No files selected
    - -
    -
    - -
    -
    -
    - - - - - - -
    -
    - -
    -
    -
    - -
    -
    - -
    -
    -
    - -
    - 0 - 255; if the brightness of a pixel is above the given level the pixel becomes white, otherwise they become black. When using alpha, opaque and transparent are used instead.
    -
    -
    - -
    -
    -
    - -
    -
    - -
    -
    -
    - - - - -
    -
    - -
    -
    -
    - Centering the image only works when using a canvas larger than the original image. -
    -
    - -
    -
    -
    - - -
    -
    - -
    -
    -
    - - - - -
    -
    - -
    -
    -
    - swap -
    -
    - -
    -
    -
    - Useful when working with the u8g2 library. -
    -
    - -
    -
    -
    - -
    -

    3. Preview

    -
    -
    -
    -
    - -
    -

    4. Output

    -
    -
    -
    -
    -
    - -
    -
    - Adds some extra Arduino code around the output for easy copy-paste into - this example. - If multiple images are loaded, generates a byte array for each and appends a counter to the identifier. -
    -
    - Adds some extra Arduino code around the output for easy copy-paste. - If multiple images are loaded, generates a single byte array. -
    -
    - Creates a GFXbitmapFont formatted ouput. Used by a modified version of the Adafruit GFX library. - GitHub project and example here. -
    - First ASCII character value is used only if a glyph identifier of length equal to 1 is not provided for each image. The value itself will be incremented by 1 for each glyph. -
    -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    - -
    -
    -
    - -
    -
    - -
    -
    -
    - - -
    -
    -
    - -
    -
    - If your image looks all messed up on your display, like the image below, try using a different mode. -
    - -
    -
    - -
    - - - - -
    -
    -
    - - +
    +
    +

    image2cpp

    +

    image2cpp is a simple tool to change images into byte arrays (or your array back into an image) for use with Arduino and (monochrome) displays such as OLEDs. + It was originally made to work with the Adafruit OLED library. An example sketch for Arduino and this library can be found here.

    +

    More info (and credits) can be found in the Github repository. This is also where you can report any issues you might come across.

    +

    This tool also works offline. Simply save this page to your computer and open the file in your browser.

    +

    + Did you find this tool useful? Feel free to support my open source software:
    + + GitHub Sponsor + +

    +
    + +
    +
    +
    +

    1. Select image

    +
    +
    +
    +

    or

    +
    +
    +

    1. Paste byte array

    +
    +
    + x + px +
    + + +
    +
    +
    + +
    +

    2. Image Settings

    +
    +
    + +
    +
    +
    +
      +
      Only images file type are allowed
      +
      No files selected
      + +
      +
      + +
      +
      +
      + + + + + + +
      +
      + +
      +
      +
      + +
      +
      + +
      +
      +
      + +
      + 0 - 255; if the brightness of a pixel is above the given level the pixel becomes white, otherwise they become black. When using alpha, opaque and transparent are used instead.
      +
      +
      + +
      +
      +
      + +
      +
      + +
      +
      +
      + + + + +
      +
      + +
      +
      +
      + Centering the image only works when using a canvas larger than the original image. +
      +
      + +
      +
      +
      + + +
      +
      + +
      +
      +
      + + + + +
      +
      + +
      +
      +
      + swap +
      +
      + +
      +
      +
      + Useful when working with the u8g2 library. +
      +
      + +
      +
      +
      + +
      +

      3. Preview

      +
      +
      +
      +
      + +
      +

      4. Output

      +
      +
      +
      +
      +
      + +
      +
      + Adds some extra Arduino code around the output for easy copy-paste into + this example. + If multiple images are loaded, generates a byte array for each and appends a counter to the identifier. +
      +
      + Adds some extra Arduino code around the output for easy copy-paste. + If multiple images are loaded, generates a single byte array. +
      +
      + Creates a GFXbitmapFont formatted ouput. Used by a modified version of the Adafruit GFX library. + GitHub project and example here. +
      + First ASCII character value is used only if a glyph identifier of length equal to 1 is not provided for each image. The value itself will be incremented by 1 for each glyph. +
      +
      +
      +
      +
      +
      +
      + +
      +
      +
      +
      +
      + +
      +
      +
      +
      +
      +
      +
      + +
      +
      +
      +
      +
      +
      + +
      +
      +
      + +
      +
      + +
      +
      +
      + + +
      +
      +
      + +
      +
      + If your image looks all messed up on your display, like the image below, try using a different mode. +
      + +
      +
      + +
      + + + + +
      +
      +
      + +