JSON-G (JSON-Graphics) is an extremely inefficient way to store raster image data, with transparency and layered support!
- None!
{
"version": "1.0",
"comment": "demo.jsng - a demo for JSON-G",
"transparency": true,
"size":
{
"width": 5,
"height": 5
},
"layers":
[
{
"default_color":
{
"red": 0,
"green": 0,
"blue": 0,
"alpha": 255
},
"pixels":
[
{
"position":
{
"x": 2,
"y": 2
},
"color":
{
"red": 255,
"green": 255,
"blue": 255,
"alpha": 255
},
"comment": "A nice white pixel."
}
]
}
]
}
This results in the following image, when converted to PNG:
...and here it is blown up, because that last one is far too small to look at and appreciate.
The rest of this repo contains specifications for how to read/write JSON-G, some sample JSON-G files as well as a PNG ⇌ JSON-G converter written in Python as a proof of concept.
There is also a resources page showcasing JSON-G libraries created by others in various languages. If you make one, feel free to PR a link to it on that page!
I'd have called it JSONP
if it hadn't already been taken, so JSON-G
was the next best thing. I put a dash in between the JSON
and G
so people wouldn't pronounce it as J-song and hopefully avert another file-extension pronunciation war.
Do whatever you want tbh.
I am absolutely sorry for doing this
— HpslUU, inventor of JSON-G
Sounds like a waste
— Jake Heinz, some guy who works at Discord.
marvelous adding jsong brb
— Jaex, creator and lead developer of ShareX
Credit to Gorialis for helping me test the spec and my converters.
Also HpslUU who gave me the whole idea for doing this anyway (and creating a GitHub account just so I could type this line).
Also check out Bogodownload!