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

[1.46]make smaller pixels

Started by Jax9123, 22 October 2012 - 06:13 PM
Jax9123 #1
Posted 22 October 2012 - 08:13 PM
Now wouldn't this be awesome, to make pixels smaller! cause i mean this can create many things such as better programs, better games, and better features such as making a T.v with only 4 square monitors!! this will be a big difference to me and my ideas if this can be implemented into computercraft :)/>/>
casr144 #2
Posted 22 October 2012 - 08:28 PM
That would be pretty cool but isn't one pixel currently equal to one character space? I'm just guessing but I think that it would be kinda difficult to make smaller pixels this way. Still a cool suggestion and it would be great to see it implemented in the mod !
PixelToast #3
Posted 22 October 2012 - 08:48 PM
would be nice for games +1
Cloudy #4
Posted 22 October 2012 - 08:50 PM
Use a monitor at max size with 0.5 size - should give you plenty of characters.
Jax9123 #5
Posted 22 October 2012 - 09:25 PM
That would be pretty cool but isn't one pixel currently equal to one character space? I'm just guessing but I think that it would be kinda difficult to make smaller pixels this way. Still a cool suggestion and it would be great to see it implemented in the mod !
well,hoping that the paintutils.drawPixel will be changed to like paintutils.drawPixel(x,y,,size)

Use a monitor at max size with 0.5 size - should give you plenty of characters.
what about computers :)/>/>
Cloudy #6
Posted 22 October 2012 - 10:42 PM
I don't think we will allow smaller text sizes. Anything could happen though.
aNemia1981 #7
Posted 27 January 2013 - 01:21 AM
Maybe just a tine bit smaller textScale option (0.25?) and config option for max monitor size? Bad idea?, but look at the kitty!

Cranium #8
Posted 27 January 2013 - 08:14 AM
The problem I foresee is lag. With minimum text scale, maximum monitor size, and fast refresh rate, drawing pixels in the screen can already cut my laptop from 30fps to 2fps. Making it any smaller would just cause more lag.
aNemia1981 #9
Posted 27 January 2013 - 08:46 AM
The problem I foresee is lag. With minimum text scale, maximum monitor size, and fast refresh rate, drawing pixels in the screen can already cut my laptop from 30fps to 2fps. Making it any smaller would just cause more lag.

I totally agree on the lag part if refreshing it constantly (example ascii movies) but for single ascii art display it would be great option (maybe just a conf setting) For this use i haven't noticed any lag. It takes 0.1 sec to draw 160x80 colored "image" (i use text, not paint api).
lieudusty #10
Posted 27 January 2013 - 10:09 AM
Maybe just a tine bit smaller textScale option (0.25?) and config option for max monitor size? Bad idea?, but look at the kitty!

Offtopic but how did you make that picture?
aNemia1981 #11
Posted 27 January 2013 - 10:45 AM
save image using 16 color palette–> made a own prog that read the pixel info and turns it into txt file where white=00…black=15, one line of codepairs is one line of pixels (don't know how to make it in lua…yet) –> in cc it reads 2 chars at time, changes the background color and writes one " " space. Must be easier way, but im still making my learning steps =)

Spoiler
Cloudy #12
Posted 27 January 2013 - 11:57 AM
You can do stuff like that and yet you still want more pixels? o.O
Cranium #13
Posted 27 January 2013 - 12:21 PM
save image using 16 color palette–> made a own prog that read the pixel info and turns it into txt file where white=00…black=15, one line of codepairs is one line of pixels (don't know how to make it in lua…yet) –> in cc it reads 2 chars at time, changes the background color and writes one " " space. Must be easier way, but im still making my learning steps =)

Spoiler
please share that code with us….
aNemia1981 #14
Posted 27 January 2013 - 12:56 PM
please share that code with us….

i cleaned it up a bit (some not so important lines still in). Its kinda my first real program so…try to bare it.
Spoiler
---ASCII printer v0.21----------------------------------------------------
--------------------------------------------------------------------------
-------------------------------------------	aNemia1981	-------------
--------------------------------------------------------------------------
--------------------------------------------------
function convertCode()
--------------------------------------------------
if codePair=="00" then code = 1
elseif codePair=="01" then code = 2
elseif codePair=="02" then code = 4
elseif codePair=="03" then code = 8
elseif codePair=="04" then code = 16
elseif codePair=="05" then code = 32
elseif codePair=="06" then code = 64
elseif codePair=="07" then code = 128
elseif codePair=="08" then code = 256
elseif codePair=="09" then code = 512
elseif codePair=="10" then code = 1024
elseif codePair=="11" then code = 2048
elseif codePair=="12" then code = 4096
elseif codePair=="13" then code = 8192
elseif codePair=="14" then code = 16384
elseif codePair=="15" then code = 32768
end
end
--------------------------------------------------
---Wrap monitor and get dimensions
--------------------------------------------------
monitor = peripheral.wrap("left")
monitor.setTextScale(0.5)
local width, height = monitor.getSize()
local centerX = math.floor(width/2)
local centerY = math.floor(height/2)
print("debug: monitor wrapped")
print("debug: "..width.."x"..height)
print("debug: "..centerX.."/"..centerY)
--------------------------------------------------
function input()
--------------------------------------------------
print("############################")
print("filename/list/clean: ")
image = read()
if image=="clean" then
clearWipe()
input()
elseif image=="list" then
shell.run("ls ccf/")
input()
else
readSize()
drawImage()
input()
end
end
--------------------------------------------------
function readSize()
--------------------------------------------------
file = fs.open("ccf/"..image..".txt","r")
print("debug: "..image.." loaded")
line = file.readLine()
imageWidth = string.len(line)/2
print("debug: "..imageWidth.." image width")
i = 0
   while file.readLine() do
   i = i + 1
   end
imageHeight = i
print("debug: "..imageHeight.." image height")
drawPointX = math.floor((width-imageWidth)/2)
drawPointY = math.floor((height-imageHeight)/2)
   if drawPointY<1 then
   drawPointy = 1
   else
   end
print("debug: "..drawPointX..","..drawPointY.." is upperleft point")
file.close()
end
--------------------------------------------------
function drawImage()
--------------------------------------------------
clearWipe()
file = fs.open("ccf/"..image..".txt","r")
monitor.setCursorPos(drawPointX,drawPointY)
monitor.setBackgroundColor(32768)
monitor.setTextColor(1)
term.setTextColor(1)
for l = 1, imageHeight do
   line = file.readLine()
	  for x = 1, imageWidth*2, 2 do
	  codePair = string.sub(line, x, x+1)
		   convertCode()
		   monitor.setBackgroundColor(code)
		   monitor.setTextColor(code)
		   monitor.write(" ")
	  end

   drawPointY=drawPointY+1
   sleep(0.01)
   monitor.setCursorPos(drawPointX,drawPointY)
   end
file.close()
end

--------------------------------------------------
function clearWipe()
--------------------------------------------------
for i = 1, height do
monitor.setCursorPos(1,i)
monitor.setBackgroundColor(32768)
monitor.write(string.rep(" ", width))
sleep(0.1)
end
end
--------------------------------------------------
input()
--------------------------------------------------

my pixel2txt program is actually made with program called "Neobook". Its kinda like multimedia kiosk maker but has some scripting capabilities and get the work done =) Until i learn this lua stuff better.

edit: http://an3mia.net/mc/ccf.rar here is some image text files if you want to check those in-game (just extract in your computer root) Use max-sized monitor thou…
Pinkishu #15
Posted 27 January 2013 - 02:39 PM
the thing i'm more interested in is actual pixels; its annoying that width and height aren't equal :P/>
now ofc that doesn'T work too well with how CC does text/pixels
AnthonyD98™ #16
Posted 27 January 2013 - 05:51 PM
Maybe just a tine bit smaller textScale option (0.25?) and config option for max monitor size? Bad idea?, but look at the kitty!

Offtopic but how did you make that picture?

Wow nice!
tesla1889 #17
Posted 28 January 2013 - 06:58 AM
You can do stuff like that and yet you still want more pixels? o.O
my thoughts exactly
Cruor #18
Posted 28 January 2013 - 10:30 AM
When in doubt, use CCLights! http://puu.sh/1M4k6
I realy should stop throwing that picture everywhere…

And that is honestly some amazing stuff with the limited monitor scale o_O
BigSHinyToys #19
Posted 28 January 2013 - 12:28 PM
I think a pixel mode that can be set on a monitor that means you cant print text to it only pixels the up side being square pixels.

something like

term.pixelMode()
local scrX,scrY = term.getSize()
for x = 1,scrX do
for y = 1,scrY do
term.setPixel(x,y,colors.white)
end
end
1029chris #20
Posted 28 January 2013 - 05:41 PM
maybe diamond monitor could have this?
ScruffyRules #21
Posted 28 January 2013 - 05:41 PM
When in doubt, use CCLights! http://puu.sh/1M4k6
I realy should stop throwing that picture everywhere…

And that is honestly some amazing stuff with the limited monitor scale o_O
i've seen this picture so many times…
Cruor #22
Posted 28 January 2013 - 07:43 PM
When in doubt, use CCLights! http://puu.sh/1M4k6
I realy should stop throwing that picture everywhere…

And that is honestly some amazing stuff with the limited monitor scale o_O
i've seen this picture so many times…
"I realy should stop throwing that picture everywhere…"
aNemia1981 #23
Posted 29 January 2013 - 05:42 AM
Thats a nice pic Cruor, but render time 10-15mins… =) I had same idea to read raw image data and convert them into cc's 16 color on the fly…but got so confused. But even with textScale 0.25 you could get 240x160 images in sec that look really nice even in low color palette. BTW, I'm thinking about making my convert program to support all possible monitor sizes. If/when done, whats the policy of sharing that app (exe) here?
PixelToast #24
Posted 29 January 2013 - 06:13 AM
id prefer source code and not an exe, you can hide nasty things >_>
lieudusty #25
Posted 29 January 2013 - 06:25 AM
When in doubt, use CCLights! http://puu.sh/1M4k6
I realy should stop throwing that picture everywhere…

And that is honestly some amazing stuff with the limited monitor scale o_O
How did you convert a picture to show up in cc lights?
Skullblade #26
Posted 29 January 2013 - 06:39 AM
please share that code with us….

i cleaned it up a bit (some not so important lines still in). Its kinda my first real program so…try to bare it.
Spoiler
---ASCII printer v0.21----------------------------------------------------
--------------------------------------------------------------------------
-------------------------------------------	aNemia1981	-------------
--------------------------------------------------------------------------
--------------------------------------------------
function convertCode()
--------------------------------------------------
if codePair=="00" then code = 1
elseif codePair=="01" then code = 2
elseif codePair=="02" then code = 4
elseif codePair=="03" then code = 8
elseif codePair=="04" then code = 16
elseif codePair=="05" then code = 32
elseif codePair=="06" then code = 64
elseif codePair=="07" then code = 128
elseif codePair=="08" then code = 256
elseif codePair=="09" then code = 512
elseif codePair=="10" then code = 1024
elseif codePair=="11" then code = 2048
elseif codePair=="12" then code = 4096
elseif codePair=="13" then code = 8192
elseif codePair=="14" then code = 16384
elseif codePair=="15" then code = 32768
end
end
--------------------------------------------------
---Wrap monitor and get dimensions
--------------------------------------------------
monitor = peripheral.wrap("left")
monitor.setTextScale(0.5)
local width, height = monitor.getSize()
local centerX = math.floor(width/2)
local centerY = math.floor(height/2)
print("debug: monitor wrapped")
print("debug: "..width.."x"..height)
print("debug: "..centerX.."/"..centerY)
--------------------------------------------------
function input()
--------------------------------------------------
print("############################")
print("filename/list/clean: ")
image = read()
if image=="clean" then
clearWipe()
input()
elseif image=="list" then
shell.run("ls ccf/")
input()
else
readSize()
drawImage()
input()
end
end
--------------------------------------------------
function readSize()
--------------------------------------------------
file = fs.open("ccf/"..image..".txt","r")
print("debug: "..image.." loaded")
line = file.readLine()
imageWidth = string.len(line)/2
print("debug: "..imageWidth.." image width")
i = 0
   while file.readLine() do
   i = i + 1
   end
imageHeight = i
print("debug: "..imageHeight.." image height")
drawPointX = math.floor((width-imageWidth)/2)
drawPointY = math.floor((height-imageHeight)/2)
   if drawPointY<1 then
   drawPointy = 1
   else
   end
print("debug: "..drawPointX..","..drawPointY.." is upperleft point")
file.close()
end
--------------------------------------------------
function drawImage()
--------------------------------------------------
clearWipe()
file = fs.open("ccf/"..image..".txt","r")
monitor.setCursorPos(drawPointX,drawPointY)
monitor.setBackgroundColor(32768)
monitor.setTextColor(1)
term.setTextColor(1)
for l = 1, imageHeight do
   line = file.readLine()
	  for x = 1, imageWidth*2, 2 do
	  codePair = string.sub(line, x, x+1)
		   convertCode()
		   monitor.setBackgroundColor(code)
		   monitor.setTextColor(code)
		   monitor.write(" ")
	  end

   drawPointY=drawPointY+1
   sleep(0.01)
   monitor.setCursorPos(drawPointX,drawPointY)
   end
file.close()
end

--------------------------------------------------
function clearWipe()
--------------------------------------------------
for i = 1, height do
monitor.setCursorPos(1,i)
monitor.setBackgroundColor(32768)
monitor.write(string.rep(" ", width))
sleep(0.1)
end
end
--------------------------------------------------
input()
--------------------------------------------------

my pixel2txt program is actually made with program called "Neobook". Its kinda like multimedia kiosk maker but has some scripting capabilities and get the work done =) Until i learn this lua stuff better.

edit: http://an3mia.net/mc/ccf.rar here is some image text files if you want to check those in-game (just extract in your computer root) Use max-sized monitor thou…
Do you mind releasing the pixel to text program? or do you need the Neobook thingy to run it?
Cranium #27
Posted 29 January 2013 - 07:36 AM
I would love both. Perhaps you could work on it with some others to bring 16 color videos!

Edit: Or .gifs!
Cruor #28
Posted 29 January 2013 - 08:56 AM
When in doubt, use CCLights! http://puu.sh/1M4k6
I realy should stop throwing that picture everywhere…

And that is honestly some amazing stuff with the limited monitor scale o_O
How did you convert a picture to show up in cc lights?
Got Oddstr to write me some program using Pyton with PIL, it "opens" the picture and then writes all the RGB values to a file and i just read that file and throw it all over the monitor :P/>
Thats a nice pic Cruor, but render time 10-15mins… =) I had same idea to read raw image data and convert them into cc's 16 color on the fly…but got so confused. But even with textScale 0.25 you could get 240x160 images in sec that look really nice even in low color palette. BTW, I'm thinking about making my convert program to support all possible monitor sizes. If/when done, whats the policy of sharing that app (exe) here?
Well, when ccLights upgrades to not have that weird freezing bug, i would assume that rendering would take so, so much less :P/> i mean, read time is allready 2.7s for that picture
aNemia1981 #29
Posted 29 January 2013 - 12:14 PM
Do you mind releasing the pixel to text program? or do you need the Neobook thingy to run it?

Like PixelToast said…i could hide nasty things in exe, but i wont (trust me, im from internets). I could release bmp2txt as the code form but then you would have to install the yet another prog and get all required plugins for it to compile the actual app. So at your own risk, until someone makes alternative/better way todo bmp2txt…heres my way:

http://an3mia.net/mc/CC_art.rar

Package contains:


artv2 file             - Put this into your minecraft/<world>/computer/<id>/
ccf folder             - Put this into your minecraft/<world>/computer/<id>/
bmp2ColorPair.exe         - Programs thats converts pixels into numerical code and save the file as text
GIMP_cc_colorPalette.gpl    - Indexed color palette for GIMP
PS_cc_colorPalette.act        - Indexed color palette for Photoshop

How to:

1. Open image in PS or GIMP
2. Resize it max width 164px, max height 80px
3. Change image mode to indexed and load custom palette from package (Recommend you also put dither/pattern option on for better result)
4. Save as (Export as in gimp) BMP, 8bit no compression
5. Open file in bmp2ColorPair
6. Wait….takes little bit of time
7. Put <imagefilename>.txt in minecraft/<world>/computer/<id>/ccf/
8. Run artV2 in CC, load your file
9. Profit

TheOddByte #30
Posted 30 January 2013 - 12:41 PM
Do you mind releasing the pixel to text program? or do you need the Neobook thingy to run it?

Like PixelToast said…i could hide nasty things in exe, but i wont (trust me, im from internets). I could release bmp2txt as the code form but then you would have to install the yet another prog and get all required plugins for it to compile the actual app. So at your own risk, until someone makes alternative/better way todo bmp2txt…heres my way:

http://an3mia.net/mc/CC_art.rar

Package contains:


artv2 file			 - Put this into your minecraft/<world>/computer/<id>/
ccf folder			 - Put this into your minecraft/<world>/computer/<id>/
bmp2ColorPair.exe		 - Programs thats converts pixels into numerical code and save the file as text
GIMP_cc_colorPalette.gpl	- Indexed color palette for GIMP
PS_cc_colorPalette.act		- Indexed color palette for Photoshop

How to:

1. Open image in PS or GIMP
2. Resize it max width 164px, max height 80px
3. Change image mode to indexed and load custom palette from package (Recommend you also put dither/pattern option on for better result)
4. Save as (Export as in gimp) BMP, 8bit no compression
5. Open file in bmp2ColorPair
6. Wait….takes little bit of time
7. Put <imagefilename>.txt in minecraft/<world>/computer/<id>/ccf/
8. Run artV2 in CC, load your file
9. Profit

+1 For This Since It's Freakin Awesome!! :D/>
TheOddByte #31
Posted 30 January 2013 - 12:53 PM
Do you mind releasing the pixel to text program? or do you need the Neobook thingy to run it?

Like PixelToast said…i could hide nasty things in exe, but i wont (trust me, im from internets). I could release bmp2txt as the code form but then you would have to install the yet another prog and get all required plugins for it to compile the actual app. So at your own risk, until someone makes alternative/better way todo bmp2txt…heres my way:

http://an3mia.net/mc/CC_art.rar

Package contains:


artv2 file			 - Put this into your minecraft/<world>/computer/<id>/
ccf folder			 - Put this into your minecraft/<world>/computer/<id>/
bmp2ColorPair.exe		 - Programs thats converts pixels into numerical code and save the file as text
GIMP_cc_colorPalette.gpl	- Indexed color palette for GIMP
PS_cc_colorPalette.act		- Indexed color palette for Photoshop

How to:

1. Open image in PS or GIMP
2. Resize it max width 164px, max height 80px
3. Change image mode to indexed and load custom palette from package (Recommend you also put dither/pattern option on for better result)
4. Save as (Export as in gimp) BMP, 8bit no compression
5. Open file in bmp2ColorPair
6. Wait….takes little bit of time
7. Put <imagefilename>.txt in minecraft/<world>/computer/<id>/ccf/
8. Run artV2 in CC, load your file
9. Profit
When I try to run the program in CC it says: attempt to index ? (a nil value)

EDIT: Nevermind.. Seems The One Who Uses This Have to Have the Monitor on the left side.
You Should Change That So It gets the monitor side and then run it on that.