Help with Hue shifting image

Im trying to mess about with the new EditableImage but for some reason when I made my hue shifting script the image starts looking really washed out. Anyone know how to fix this?
code:

local EditableImage = game:GetService('AssetService'):CreateEditableImageAsync('rbxassetid://170813158')

EditableImage.Parent = script.Parent

local Resolution = EditableImage.Size

local Image = EditableImage:ReadPixels(Vector2.zero,Resolution)
local Pixels = {}

for i = 1,#Image/4 do
	local Index = math.clamp((i-1)*4,1,#Image)
	local A = Image[Index]

	local R = Image[Index+1]
	local G = Image[Index+2]
	local B = Image[Index+3]

	local H,S,V = Color3.new(R,G,B):ToHSV()
	Pixels[i] = {A,H,S,V}
end

while true do
	task.wait()
	local NewImage = {}
	for i,v in pairs(Pixels) do
		v[2] = v[2] >= 1 and 0 or v[2] + .1

		local NewColor = Color3.fromHSV(v[2],v[3],v[4])
		table.insert(NewImage,v[1])
		table.insert(NewImage,NewColor.R)
		table.insert(NewImage,NewColor.G)
		table.insert(NewImage,NewColor.B)
	end
	EditableImage:WritePixels(Vector2.zero,Resolution,NewImage)
end

image

1 Like

turns out i was setting the alpha at the start of the pixel when it is supposed to be at the end. that fixed it

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.