Captures APIs are now available!

Excellent feature! I strongly support @NotRapidV idea to be able to use the screenshots in-game. I have a social feed in the game where people can share what they’re up to. Allowing them to post photos would greatly enhance immersion

6 Likes

The temporary ContentIds will be available for one session only, so they won’t be available between sessions. To have the screenshot be available to the user after they leave the game you will need to prompt them to save the screenshot.

The temporary ContentId should work anywhere image ContentIds currently work, including in ImageLabels and Decals.

8 Likes

Hmm… I just wished there was a way to turn this into an editable image, without the user needing to save the image.

5 Likes

Currently, users can only take captures on mobile devices.

-- okay a far bigger issue is that there is doesn’t seem to be any way to check if the user is actually able to take captures?? CaptureScreenshot runs just fine on PC as my share buttons are appearing, but then the two Prompt functions just do not do anything at all, leaving me with two functionless buttons on PC.

-- this would be easier to deal with if we finally got a proper way of detecting if a user is on a mobile device btw, this obsession with never letting us simply detect what type of device the user is using straight up is becoming more and more of a problem as more inconsistencies like this begin showing up across different platforms

6 Likes

Interesting, how so? This could be used for a social media type feed right?

2 Likes

when you call
CaptureService:CaptureScreenshot(onCaptureReady(contentId))

you simply pass the contentId argument to AssetService:CreateEditableImageAsync()

could be used for a social media type feed right?

you’d need to come up with a way on how to compress the raw RGBA image data

the maximum image size for EditableImages is 1024x1024, translating that to raw RGBA size is 4194304 bytes or 4.1 megabytes :grimacing:

6 Likes

This is what I came up with. It will work, but the data is quite large. You can send the data you receive from the function to other players and create a new image with EditableImage:WritePixels(data). The question is, how safe is it to show to other players? Can a client somehow display a non-game image? If so, you shouldn’t use this solution

local assetService = game:GetService("AssetService")
local captureService = game:GetService("CaptureService")
local function readCapturedScreenshot(callback)
	local screenshotData = nil
	captureService:CaptureScreenshot(function(contentId)
		local editableImage = assetService:CreateEditableImageAsync(contentId)
		editableImage.Parent = workspace
		if editableImage.Size.X > 1024 then
			editableImage:Resize(Vector2.new(1024, 1024 * (editableImage.Size.Y / editableImage.Size.X)))
		end
		if editableImage.Size.Y > 1024 then 
			editableImage:Resize(Vector2.new(1024 * (editableImage.Size.X / editableImage.Size.Y), 1024))
		end
		screenshotData = editableImage:ReadPixels(Vector2.new(), editableImage.Size)
		callback(screenshotData)
	end)
end

readCapturedScreenshot(function(data)
	print(string.len(game:GetService("HttpService"):JSONEncode(data)))  -- the screenshot is around 24 MB, its quite a lot :/
end)
3 Likes

That will be really useful for my talk-show experience where people can meet the guest & take pictures! Thank you!

4 Likes

Does screenshot capture go through a moderation process? If I captured something that seemed against TOS, would I be moderated for it? This sounds like a good tool for reporting players/games, but I wouldn’t want to face moderation in the process.

3 Likes

you can probably get it down to around 4 megabytes if you use the full 1024x1024 or less if you have to resize it, but exploiters can technically just send a different image if you have a remote that sends the data to the server, so displaying it may not be safe.

4 Likes

Just to confirm these screenshots are not stored on Roblox’s servers globally

I ask this because if they are uploaded, would there be moderation repercussions in the case that a bad actor setups a not safe for roblox scene and calls the screenshot function without consent of the player

4 Likes

The screenshot is not stored server side at all, and it will only be stored locally for the user if the user accepts the prompt to save the screenshot. Otherwise the screenshot will be available as a temporary ContentId for the current session only.

4 Likes


is it gonna have a once per second ratelimit forever or is it just while its being worked on cause it would be pretty neat to use this for realtime postfx

15 Likes

These new properties already seem to exist but do not work yet, is that intentional?

6 Likes

@TheGamer101 are the currently available APIs sufficient for creating an in-game camera app that allows users to save photos they take to a persistent in-game gallery?

3 Likes

Is it possible to use the temporary ContentId within a custom teleport gui, in order to replicate the way games like Half-Life show a freeze-frame when transitioning between levels?

4 Likes

realtime postfx

until we get actual shaders to run on here, anything “realtime postfx” related will never happen
the main bottleneck is when the graphics API requests the GPU to synchronize to pull the viewport image
on my system, a 1200x1200 screenshot takes 0.10 seconds

2 Likes

This is a very cool demo! We absolutely want to improve the performance of the API in future iterations, so that calling the API a few times rapidly in succession would be possible. There will likely still be some delay before the image is available depending on the device, but we already have a ticket in the backlog to improve this in the near future.

11 Likes

No thanks
I can see this leading to a lot of developers starting video recordings all the time
Which would make roblox barely run

3 Likes

I wonder when we will be able to do recordings of the in-game experience with better quality than there is today.
Right now it’s better to use OBS instead of roblox’s built-in pixelated video recording.

Picture-taking is also a nice feature, but video is more used.

4 Likes