alt.getHeadshotBase64
Gets a pedestrian headshot as a string. The image is either 64x64
or 128x128
.
Returns a string
representation of an image in base64 format. Saving the string as a .jpg
will result in an image.
Natives to call before using this function:
native.registerPedheadshot
native.registerPedheadshotTransparent
native.registerPedheadshot3
Declaration
alt.getHeadshotBase64(headshotFromNative: number): string
Usage
const result = alt.getHeadshotBase64(someHeadshotID);
Real World Example
const someHeadshotID = native.registerPedheadshot(alt.Player.local.scriptID);
const result = alt.getHeadshotBase64(someHeadshotID);
console.log(result);
Example Image Output
These examples assume you have imported alt
from alt-client
.