Making canvas smaller at 480p

So, I’m making a thing that allows you to put an image on your pc, then python gets all the data and converts it to hex color values, then, using httpservice, roblox gets the data, its working fine, but the canvas in roblox is WAYYYYY to big, it should be a lot smaller but still be 480p

(the canvas at 480p that should be way smaller but still 480p)


local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Display = workspace:WaitForChild("Display")

local Remotes = ReplicatedStorage:WaitForChild("Remotes")
local HttpSendToClient = Remotes.HttpSendToClient

local PixelClone = script.Pixel
local pixelSize = 1
local xRes, yRes = 640, 480

local DisplayPxFolder = Display.Parts
local originVector3 = Display.Position

local displayInitialized = false

local function hex2rgb(hex)
	hex = hex:gsub("#","")
	local r = tonumber("0x"..hex:sub(1,2))
	local g = tonumber("0x"..hex:sub(3,4))
	local b = tonumber("0x"..hex:sub(5,6))
	return Color3.fromRGB(r,g,b)
end

local function InitDisplay()
	print("Initializing...")
	
	for x = 1, xRes, pixelSize do
		for y = 1, yRes, pixelSize do
			local px = PixelClone:Clone()
			px.Position = originVector3 + Vector3.new(x, y, 0)
			px.Parent = DisplayPxFolder
		end
		task.wait()
	end
	
	displayInitialized = true
	print("Finished initializing.")
end

local function DrawImage(data)
	repeat task.wait(1) until displayInitialized
	print("Drawing...")
	
	for i, p in ipairs(DisplayPxFolder:GetChildren()) do
		p.Color = hex2rgb(data[i])
	end
	
	print("Finished drawing.")
end

InitDisplay()

HttpSendToClient.OnClientEvent:Connect(function(httpDecodedData)
	DrawImage(httpDecodedData)
end)

Modify the pixelSize variable(for example make it equal to 0.5), then on your for x, y loops, make the step equal to 1(not pixelSize). To position the part use the following formula: px.Position = originVector3+Vector3.new(x*pixelSize, y*pixelSize, 0) and make sure the PixelClone size is equal to Vector3.new(pixelSize, pixelSize, 0).

1 Like

ill try this

30billiontrillion