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

Http Image Converter

Started by Left4Cake, 09 June 2013 - 09:02 PM
Left4Cake #1
Posted 09 June 2013 - 11:02 PM
I guess this got lost during the forum roll back. Did not realize until now.

Image will be up as soon as I find the time to make new once.


This program "pastebin get DNL2tH07 httpimg" can convert images from a url to .npf format via this php script "http://pastebin.com/YnGQ1eTZ".

Syntax
httpimg url
httpimg url rescaleX&Y
httpimg url rescaleX rescaleY

Note:You must either have npaintpro or change the code on line 36 to run a different program that can open the image, or rename said other to "npaintpro" I acutally forgot I set it to automatically open npaintpro. :P/>

edit: sorry the post was not clear, it was much clearer the first time but I am way busier now a days then before the first post got deleted. :(/>
Sario #2
Posted 10 June 2013 - 07:56 AM
How exactly does this work? I downloaded this and I am typing httpimg and then the URL but it is not doing anything, I also tried to put the image on a monitor and it said no such program for that too. Am I missing something?
JustPingo #3
Posted 10 June 2013 - 10:40 AM
When you run it, it create a file "*something*.npf".

.npf is a file extension for NPaint Pro.
So you have to run your pictures with it.
Left4Cake #4
Posted 10 June 2013 - 12:12 PM
You can use paint. its just npaintpro requires ".npf" to open it. While any other programs will open anything you throw at it. So I put the .npf really just for convince. However paint dose not support a canvas size larger then the screen.

You can also run something like


screen = peripheral.wrap("top") --change side to dise monitor is on.
term.redirect(screen)
image = paintutils.loadImage("image.nfp")
paintutils.drawImage(image, 1, 1)
term.restore()

to put it on a monitor
115zombiekiller #5
Posted 10 June 2013 - 08:26 PM
Pretty insane! :D/>
Diet #6
Posted 16 June 2013 - 06:36 AM
So does this actually pull an image from a website and displays it in minecraft?

I tried to get the syntax to work, but I kept getting errors, and the program it downloads from the pastebin looks VERY different compared to the code in the pastebin link.

How exactly do you get this working? does it need other programs?
1lann #7
Posted 16 June 2013 - 07:58 AM
So does this actually pull an image from a website and displays it in minecraft?

I tried to get the syntax to work, but I kept getting errors, and the program it downloads from the pastebin looks VERY different compared to the code in the pastebin link.

How exactly do you get this working? does it need other programs?
One of them is the client program, the other is the PHP script for a server, showing how it converts images to a npf format
Diet #8
Posted 16 June 2013 - 03:50 PM
So does this actually pull an image from a website and displays it in minecraft?

I tried to get the syntax to work, but I kept getting errors, and the program it downloads from the pastebin looks VERY different compared to the code in the pastebin link.

How exactly do you get this working? does it need other programs?
One of them is the client program, the other is the PHP script for a server, showing how it converts images to a npf format

So how exactly would I need to set this up? Would I need to host some sort of webpage with the images I want?
diegodan1893 #9
Posted 16 June 2013 - 04:38 PM
Not exactly. You run the program with an URL of a image and it will download it as a nfp file. The php script is only for show how it works.
Diet #10
Posted 16 June 2013 - 07:15 PM
Not exactly. You run the program with an URL of a image and it will download it as a nfp file. The php script is only for show how it works.

Ah starting to get it now, running "pastebin get DNL2tH07 httpimg" generates the program "httpimg" which when you run it calls the script found at http://pastebin.com/YnGQ1eTZ to convert the image to a .npf which can then be displayed.

Sorry, new to computercraft. When I attempt to run "httpimg https://wwww."ect ect with a url to an image I get a "No Such Program" error, is this because it's failing to call the php script? I don't see any images being created in the computer/0 directory, but maybe I'm misunderstanding the way to implement this.

Got it to work, the program was trying to call "npaintpro" and since I assume I'm on an older version all I have is "paint". Changing that got it working, very nice!
diegodan1893 #11
Posted 17 June 2013 - 11:08 AM
Got it to work, the program was trying to call "npaintpro" and since I assume I'm on an older version all I have is "paint". Changing that got it working, very nice!

NPaintPro is a program made by nitrogenfingers. It doesn't come with ComputerCraft, but you can get it here: http://www.computercraft.info/forums2/index.php?/topic/5029-145-npaintpro/