Made an (incredibly unefficient and laggy) image renderer on Roblox with Luau + Python

I don’t know how should I optimize this, but I’ve simply made a image renderer (and yes I worked this on Linux, no need to question the different start menu and stuff)

Basically:

  • I wrote a python script that reads every pixel of a image file and makes a Lua[u] array like this:
return {
    { # X
        {R,G,B} # Y
    },
    { # X
        {R,G,B} # Y
    },
}
  • In order to save this whole array to a ModuleScript, I saved the place file containing the renderer script and a ModuleScript for containing the data as the Roblox XML Place Format (rbxlx), had to do this since upon pasting the whole script, my entire cpu (not computer) lagged to the point where music would even loopback (had to sysrq in here to escape)
  • The renderer simply reads the array, creates a Frame based on the data (setting position and BackgroundColor3)

The picture is shown very pixelated because I rescaled 50 offset from Roblox, I had to resize the original picture from 1920x1080 to 200x113 otherwise it would take a while because it tends to throttle on the 400th X row rendering

I’m open for feedbacks here, additionally should I release this to the public?

no, you cannot use this on a production/live game because it technically counts as bypassing Roblox’s moderation system

6 Likes

I decided to use GreedyCanvas and it optimized the renderer, however I forgot that Roblox’s engine has a hardlimit on UI rendering where after a certain amount of ui it stops rendering the rest of the ui, which is shown below (I tried rendering the original 1920x1080 picture from the picture on the op post), I tested on both Windows and Linux and theres no difference whatsoever

1 Like

Nice, I’m also attempting to create a module similar GreedyCanvas.

Suisei is very cute (.///. )

1 Like

BasePart render: (Picture rescaled from 1920x1080 to 1280x720)

Couldn’t get a 1080p render, because Studio takes up all of my laptop’s ram
Screenshot_20220304_135153
Screenshot_20220304_135141

1 Like

As suggested by @XxprofessgamerxX in this thread, I’ve made a local server for hosting the image data using Python + Flask, meaning now I don’t have to store data in the place file (and experience massive lag when opening scripts)

No, I still cannot render a 1920x1080 picture because I run out of ram when it’s near done

1 Like

When sending data over, how is the pixel data stored? Is it like {{255,255,255},{…

I decided to use json instead, so it basically sends a json over, then I use JSONDecode and turn it to a Lua array just like this:

1 Like

You could use MaximumADHD’s PNG Library instead of using a python script for getting the image’s pixel data