Posted 18 July 2017 - 01:04 PM
I have noticed, that some people write a temporary file to loda a image. To help this people I have write a small program, that converts a image to code. I know, you can just use textutils.serialize but the output of my program looks better,
Instalation:
Usage:
imagecon <inputfile> <outputfile>
inputfile is the path of your Picture.
After Running you can copy the content of the outputfile in your program.
Instalation:
wget https://raw.githubusercontent.com/Wilma456/Computercraft/master/Tools/imagecon.lua imagecon.lua
Or with PackmanUsage:
imagecon <inputfile> <outputfile>
inputfile is the path of your Picture.
After Running you can copy the content of the outputfile in your program.
Example
The Picture
b b b b b b b b b bbb bbbb
b b b b b b bb bb b b bb b b
b b b b b b b bb b bbbbb bbbb bbb bbbb
b b b bbb b b b b b b bbb bbbb
is converted into
local tImage = {
{02048,00000,00000,00000,00000,00000,02048,00000,00000,00000,00000,02048,00000,02048,00000,02048,00000,00000,00000,02048,00000,00000,00000,00000,02048,00000,00000,00000,00000,02048,00000,00000,00000,00000,00000,00000,02048,00000,00000,02048,02048,02048,00000,02048,02048,02048,02048},
{00000,02048,00000,00000,00000,02048,00000,02048,00000,00000,02048,00000,00000,02048,00000,02048,00000,00000,00000,02048,02048,00000,00000,02048,02048,00000,00000,00000,02048,00000,02048,00000,00000,00000,00000,02048,02048,00000,00000,02048,00000,00000,00000,02048,00000,00000,00000},
{00000,00000,02048,00000,02048,00000,00000,02048,00000,02048,00000,00000,00000,02048,00000,02048,00000,00000,00000,02048,00000,02048,02048,00000,02048,00000,00000,02048,02048,02048,02048,02048,00000,00000,02048,02048,02048,02048,00000,02048,02048,02048,00000,02048,02048,02048,02048},
{00000,00000,00000,02048,00000,00000,00000,00000,02048,00000,00000,00000,00000,02048,00000,02048,02048,02048,00000,02048,00000,02048,00000,00000,02048,00000,02048,00000,00000,00000,00000,00000,02048,00000,00000,00000,02048,00000,00000,02048,02048,02048,00000,02048,02048,02048,02048},
}
paintutils.drawImage(tImage,1,1)