Assigning ImageContent causes the image to flicker

I have a ImageLabel inside a surfacegui that I set to an EditableImage’s Content, but whenever I do, it flickers slightly. Have you encountered something like this, and if so, what was your fix? I have the content stored so it’s only using Content.fromObject(…) once, so I’m not really sure why this is happening…
https://i.gyazo.com/64e506b60ef3fabf6111ee64adeabfba.gif hard to see in this clip due to the frame rate but its there.
Once again, this is specifically when I used editable images and ImageContent. When I just assign ImageLabel.Image to a valid asset Id, there is no flicker(besides the first time it loads the image, which is solved through preloading.)
I need to use editable images, so switching is not an option for me.
Example code, trimmed down slightly

local AS = game:GetService("AssetService")

local ISEDITABLE = false

local Image —set to imageLabel

local EditableSprites = {
    Content.fromObject(AS:CreateEditableImageAsync("rbxassetid://104132816433397")),
    Content.fromObject(AS:CreateEditableImageAsync("rbxassetid://72374745622072")),
    Content.fromObject(AS:CreateEditableImageAsync("rbxassetid://112616028556686")),
    Content.fromObject(AS:CreateEditableImageAsync("rbxassetid://127661873864102"))
}
local Sprites = {
    "rbxassetid://104132816433397",
    "rbxassetid://72374745622072",
    "rbxassetid://112616028556686",
    "rbxassetid://127661873864102",
}
local bleh = 4

function Update(dt)—fire every second
    bleh += 1
    if bleh == 5 then
        bleh = 1
    end
    if ISEDITABLE then
        Image.ImageContent = EditableSprites[bleh]
    else
        Image.Image = Sprites[bleh]
    end
end

could you make 4 images, overlap them, and periodically switch up the Z-index (or image transparency, dont really think it makes much of a difference)

Sadly it’s not just those 4 images
There’s multiple animations each with about 3 frames for each side so we’re looking at 12 frames per thing(roughly 36 total)
Not to include cosmetics which also have 12 frames, etc

Update: The issue is between switching between multiple editable images. When it is only one, the imageLabel does not flicker at all.
This is still an issue for me so I’m not marking this as solved.

SOLUTION FOUND BY MY BUDDY WHO WISHES TO REMAIN ANONYMOUS AT THIS TIME
You need one EditableImage(“MainImage”) that always is used.
WHen you want to load another editableImage, just use DrawImage(Vector2.zero, EVILIMAGE2, Enum.ImageCombineType.Overwrite).

Example code

local AssetService = game:GetService("AssetService")

local eImage = AssetService:CreateEditableImage()
local eImageA = AssetService:CreateEditableImage()

local EVILIMAGE = AssetService:CreateEditableImageAsync("rbxassetid://14664220184")
local EVILIMAGE2 = AssetService:CreateEditableImageAsync("rbxassetid://15434882219")

local MAINIMAGE = AssetService:CreateEditableImage({Size = Vector2.new()})
local label = game.Players.LocalPlayer.PlayerGui:WaitForChild("SurfaceGui").ImageLabel
label.ImageContent = Content.fromObject(eImage)
local TIME = 0.2
while wait(TIME) do
	MAINIMAGE:DrawImage(Vector2.zero, EVILIMAGE2, Enum.ImageCombineType.Overwrite)
	label.ImageContent = Content.fromObject(MAINIMAGE)
	wait(TIME)

	MAINIMAGE:DrawImage(Vector2.zero, EVILIMAGE, Enum.ImageCombineType.Overwrite)
	label.ImageContent = Content.fromObject(MAINIMAGE)
end
1 Like

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