Captures APIs are now available!

Would there be an option in the :CaptureScreenshot() function to crop the resultant screenshot? I’m trying to make a Kodak-style camera tool, but unfortunately it always has the aspect ratio of the players screen, rather than the classic 1:1 ratio.

If there was an option to crop the screenshots, it would allow more possibilities for more immersive photo-taking, and more interesting photos for players to share.

1 Like

C:\Users\[Your Name]\AppData\Local\Roblox\UserCaptures
I found the capture location

I’ve been trying to do this, did you make the captured image larger than the picture in the middle or how does it exactly work?


That’s Cool!

9 Likes

I dont know if i’m right, i’ve never used asset service properly.

Capture:CaptureScreenshot(function(id)
ImageLabel.Image = id
assetservice:CreateEditableImageAsync(id)
end)

Could you correct me with the right usage?

1 Like

if you do not need to modify the image, you can only use an ImageLabel

CaptureService:CaptureScreenshot(function(id)
    local NewImageLabel = Instance.new("ImageLabel")
    NewImageLabel.Image = id
    NewImageLabel.Parent = <insert parent>
   
end)

if you want to modify the image with EditableImage:

CaptureService:CaptureScreenshot(function(id)
    local NewScreenshot = AssetService:CreateEditableImageAsync(id) -- returns EditableImage, see https://create.roblox.com/docs/reference/engine/classes/EditableImage for more details
    -- resize image to 512x512, for example
    NewScreenshot:Resize(512,512)
   
    -- create ImageLabel to preview changes
    local NewImageLabel = Instance.new("ImageLabel")
    NewScreenshot.Parent = NewImageLabel
    NewImageLabel.Parent = <insert parent>
   
end)
3 Likes

Have you guys considered letting us publish these image assets, via a plugin? i.e: If I wanted to make a plugin that automatically generates a bunch of icons and then saves them, for use in game.

1 Like

I would love to be able to publish these temporary images so that they become permanent. I’m working on a document system where researchers upload their own documents, it would be great if they could also include images in them for proof.

2 Likes

This is better than the avatar changing API in my opinion

Better yet - is support for actual shaders and postfx on the horizon? It would be much more performant than taking a screenshot every frame with CaptureService and doing expensive CPU math on it.

1 Like

You could probably get around this restriction by converting it into an EditableImage and then saving it

@TheGamer101, a month has passed since this was brought up by ObviouslyGreen and Abcreator. As far as I see there are no responses to their questions.

So I’d like to revisit this once more – these properties aren’t working on developer activated captures, is this intentional?

2 Likes

Experimented around further and it appears that when these properties are enabled, the CoreGui is physically disabled during a player-activated capture, very possible that this was done due to a combination of security-reasons as well as technical-limitations. Hope that this changes in the future, however.

3 Likes

This is awesome !!!
Very easy & completed API as usual, Thanks @TheGamer101

1 Like

Clicking the save to device button on a capture in the roblox escape menu causes Roblox studio to crash.

This is reoccuring and happens on my M1 Macbook Air running MacOS 14.2.1

I’ve actually achieved this earlier in the night, If you are interested in how I accomplished it feel free to reach out!

Thanks for taking the time to report this. This issue should be fixed in the latest version of studio.

2 Likes

Basic swipe transition :smile:

Trying to make a square panel grow transition but the 1024 pixel read/write limit :pensive:
at least it makes for a cool frame effect.

5 Likes

I really love the new API, however, I am concerned about its potential for misuse in collecting data without user consent or awareness.

Whilst playing around with the API I have noticed the absence of a prompt triggered by the :CaptureScreenshot() method, making it possible for developers to take screenshots of a user’s ROBLOX session without detection. This lack of notification could enable undectable data collection on all users on roblox.

Delving further, I approached the API from a more malicious standpoint and discovered a method to seamlessly export taken screenshots from ROBLOX to my web server in real-time. Subsequently, I could recreate the image or even generate a video of the ROBLOX session without the user’s knowledge. This recording process operates without any prompts or noticeable screen lag, leaving the targeted user unaware of their session being surveilled.

The scary thing is that it’s not that hard to pull off.

  1. Capture the screenshot with the :CaptureScreenshot()-method of the CaptureService.
  2. Use the id to create an EditableImage-Instance using the :CreateEditableImageAsync()-method of the AssetService.
  3. Send the EditableImage-Instance to a ServerScript via RemoteEvent.
  4. Partition the screenshot into chunks using the :ReadPixels()-method of the created EditableImage-Instance.
  5. Remove unnecessary image-data. There is no need to keep the alpha-values for the pixels given by the :ReadPixels()-method as for the screenshot they are always 0. (this makes the end-size of the image 25% smaller).
  6. Send the chunk to your web server using the HTTP Service.
  7. On the webserver, read the data and convert it to any image or video format.

It should be mentioned that this only works for sessions created in ROBLOX Studio as the EditableImage is not yet realeased for the ROBLOX Client.

A simple way to counter this misuse is by adding a prompt to the :CaptureScreenshot()-method when invoked. I do understand that without the prompt developers could use the Service for exploit-protection systems but the possiblity that other malicious developers could gather data of minors without their (parent’s) concent or knowledge is more serious.

Thank you for considering my concerns.