Jump to content




trying to convert PNG to drawable image


3 replies to this topic

#1 lolmaker2002

  • Members
  • 28 posts
  • LocationSomewhere in Nowhere

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)

#2 Emma

  • Members
  • 216 posts
  • Locationtmpim

Posted 11 March 2017 - 05:27 PM

Bomb Bloke has a GIF API here

Edited by Incinirate, 11 March 2017 - 05:28 PM.


#3 FuzzyLitchi

  • Members
  • 34 posts

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 by FuzzyLitchi, 11 March 2017 - 08:52 PM.


#4 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 12 March 2017 - 04:10 AM

View Postlolmaker2002, on 11 March 2017 - 03:27 PM, said:

(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.





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users