This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
lolmaker2002's profile picture

trying to convert PNG to drawable image

Started by lolmaker2002, 11 March 2017 - 02:27 PM
lolmaker2002 #1
Posted 11 March 2017 - 03:27 PM
I've been looking arround for a API/Library/Program that is able to convert PNG / GIF / JPEG / .. to a drawable image in-game. but with no success.

if anyone could like me a API or something that could help me further, that would be kindly appreciated!

(if your wondering why, i found a website that will generate QR codes with a http.get request, and will download the image)
Emma #2
Posted 11 March 2017 - 05:27 PM
Bomb Bloke has a GIF API here
Edited on 11 March 2017 - 04:28 PM
FuzzyLitchi #3
Posted 11 March 2017 - 08:52 PM
This is a qr code generating API, it doesn't draw it for you, it returns a 2d table.

You could draw this by using something similar to this code

qrencode = dofile("qrencode.lua")

local success, table = qrencode.qrcode("string to be encoded")

if success then
  for x, row in ipairs(table) do
	for y, value in ipairs(row) do
	  --draw white or black square depeding on value
	end
  end
else
  print("Error")
end
Edited on 11 March 2017 - 07:52 PM
Bomb Bloke #4
Posted 12 March 2017 - 04:10 AM
(if your wondering why, i found a website that will generate QR codes with a http.get request, and will download the image)

Unless that website offers text-based downloads, you'll have trouble getting CC's http API to handle its output - and if it does, then you likely won't need a GIF/JPG/whatever API.

Using a local generator such as the one FuzzyLitchi linked seems a better idea.