Advertisement
ElijahCrafter

Untitled

Apr 29th, 2024 (edited)
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. -- Load the image file
  2. local imageFile = fs.open("image.nfp", "r")
  3. local imageContents = imageFile.readAll()
  4. imageFile.close()
  5.  
  6. -- Open a new monitor
  7. local monitor = peripheral.wrap("top")
  8. monitor.setTextScale(0.5) -- Adjust text scale if necessary
  9.  
  10. -- Clear the monitor
  11. monitor.clear()
  12.  
  13. -- Decode and draw the image on the monitor
  14. local x, y = 1, 1
  15. for byte in imageContents:gmatch(".") do
  16. monitor.setPixel(x, y, tonumber(byte, 16))
  17. x = x + 1
  18. if x > monitor.getSize() then
  19. x = 1
  20. y = y + 1
  21. end
  22. end
  23.  
  24. -- Wait for user input (optional)
  25. print("Press any key to exit")
  26. os.pullEvent("key")
  27. xit")
  28. os.pullEvent("key")
  29.  
Tags: test
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement