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

Paint Picture?

Started by Azhf, 09 March 2013 - 09:37 AM
Azhf #1
Posted 09 March 2013 - 10:37 AM
Is there somehow a way to get the paint files from advanced computers to a picture? If so, where are the paint files found? Ex: Say I wanted to get a profile picture. I painted it on an advanced computer. How could I find that file? Thanks.
remiX #2
Posted 09 March 2013 - 10:40 AM
paintutils API!

Picture file:

0000000000000000
1111111111111111
3333333333333333
6666666666666666
eeeeeeeeeeeeeeee
fffffffffffffffffffffffffffffff

Code to paint the picture:

local pic = paintutils.loadImage( 'imageFile' )

paintutils.drawImage( pic, 1, 1 ) -- 1, 1: x, y co-ords

The colour codes are hexidecimals (i think that's what they are :P/>)
If you need to know all of them, run this code on another advanced PC:

term.clear()
t = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"}

local function hexLookup( char )
	local value = tonumber(char, 16)
	return (value and math.pow(2, value) or nil)
end

for i = 1, #t do
	term.setBackgroundColour( hexLookup( t[i] ) )
	for y = 1, 19 do
		term.setCursorPos( i*3, y )
		write( '   ' )
	end
	term.setBackgroundColour( colours.black )
	term.setCursorPos( i*3+1, 9 )
	write( t[i] )
end

print('\n')
Azhf #3
Posted 09 March 2013 - 10:41 AM
O_O What? XD
Kingdaro #4
Posted 09 March 2013 - 10:46 AM
This is really all you need to know that he posted.


local pic = paintutils.loadImage( 'imageFile' )

paintutils.drawImage( pic, 1, 1 ) -- 1, 1: x, y co-ords

Where 'imageFile' is the name of the image you made.
Azhf #5
Posted 09 March 2013 - 10:50 AM
What does it do? Could I have it for my desktop or something?
Kingdaro #6
Posted 09 March 2013 - 10:52 AM
paintutils.loadImage() finds an image file named 'imageFile', then stores it in the variable "pic". paintutils.drawImage() draws the image file stored in the variable, pic.

So yes, you could have it for your desktop, I suppose. But when you say that, it makes me think that you're using someone else's OS, but you want to know how to customize your image for that OS. The topic is rather vague.
Azhf #7
Posted 09 March 2013 - 10:55 AM
paintutils.loadImage() finds an image file named 'imageFile', then stores it in the variable "pic". paintutils.drawImage() draws the image file stored in the variable, pic.

So yes, you could have it for your desktop, I suppose. But when you say that, it makes me think that you're using someone else's OS, but you want to know how to customize your image for that OS. The topic is rather vague.
Oh, nah, I was going to MAYBE use it for my profile pic, and for one of my topics, a logo. XD
Kingdaro #8
Posted 09 March 2013 - 10:56 AM
OH, you mean for the forums?

Can't really do that without using an external tool. However, you could use a lua program to draw it using the code remiX and I gave you, then take a screenshot of it and save it as an image.

Files are stored like this:

ab5465b
666bfea
bf0d002

And aren't actual images.
remiX #9
Posted 09 March 2013 - 11:02 AM
OHHH Forum Profile Picture! Lol!

Take a screenie and crop it or use the snipping tool. Save it and make it your profile picture o,o
Azhf #10
Posted 09 March 2013 - 11:04 AM
OHHH Forum Profile Picture! Lol!

Take a screenie and crop it or use the snipping tool. Save it and make it your profile picture o,o
Ah Lol. Ok