Game Screenshots
Use the game screenshots feature to take an in-game picture and post it to a user’s profile. This is useful for games that allow customization or have unique moments that players may want to share.
Steps Overview
- Setup the canvas
- Encode to base64
- Submit using the SDK
Step 1
Remove any UI elements that should not be in the image. Buttons and game features can be hidden. Logos may be kept or removed depending on what is wanted.
Step 2
Once the canvas is ready, use toDataURL to encaode the image. Y8 Account supports either image/png or image/jpeg formats. Use a png when working with a limited color palette to reduce the download size. The final string should start with data:…
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNb
Step 3
Finally, submit the base64 encoded image using the Y8 Account SDK. The following shows the structure of the submit function and an example.
ID.submit_image('base64 image string', callback_function)
Screenshots are displayed on the user’s Y8 Account profile. Any game that uses the screenshot feature, should have some way to view the porfile. Call the openProfile link to open a new window of the player’s profile.
Live Examples
The following examples use the screenshots feature to produce screenshots of unique in-game moments. They also display links to the player’s profile.