We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sorry , this is not a bug . but I really need to save image to photo album . it is a very important function for my app .
The text was updated successfully, but these errors were encountered:
Here's the code I took a screenshot of and saved it to an album, hope it helps!
Note: The get_viewport().get_texture().get_data() code interferes with the main process, so it's a good idea to add a new thread to handle this part.
get_viewport().get_texture().get_data()
gdscript
var image: Image = get_viewport().get_texture().get_data() image.flip_y() var img_base64 = Marshalls.raw_to_base64(image.save_png_to_buffer()) screen_tools.screenshot(img_base64) Toast.toast("screenshot success", 1, Toast.pos.top)
objective-c
void ScreenTools::screenshot(const String &img_base64) { NSString *base64String = [NSString stringWithUTF8String:img_base64.utf8().ptr()]; NSData *data = [[NSData alloc] initWithBase64EncodedString:base64String options:0]; UIImage *image = [UIImage imageWithData:data]; UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil); AudioServicesPlaySystemSound(1108); }
Sorry, something went wrong.
No branches or pull requests
sorry , this is not a bug . but I really need to save image to photo album . it is a very important function for my app .
The text was updated successfully, but these errors were encountered: