Skip to content

Commit 5302156

Browse files
rarattayRachelRattay
and
RachelRattay
authored
Changing screenshot jpeg quality to 80% (#227)
Co-authored-by: RachelRattay <[email protected]>
1 parent 13df926 commit 5302156

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Modules/@babylonjs/react-native/android/src/main/java/com/babylonreactnative/EngineView.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public void takeSnapshot() {
125125
String encoded = "";
126126
if (copyResult == PixelCopy.SUCCESS) {
127127
ByteArrayOutputStream byteArrayStream = new ByteArrayOutputStream();
128-
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, byteArrayStream);
128+
bitmap.compress(Bitmap.CompressFormat.JPEG, 80, byteArrayStream);
129129
byte[] byteArray = byteArrayStream.toByteArray();
130130
bitmap.recycle();
131131
encoded = Base64.encodeToString(byteArray, Base64.DEFAULT);

Modules/@babylonjs/react-native/ios/EngineViewManager.mm

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ - (void)takeSnapshot {
8080
// Grab the image from the graphics context, and convert into a base64 encoded JPG.
8181
UIImage* capturedImage = UIGraphicsGetImageFromCurrentImageContext();
8282
UIGraphicsEndImageContext();
83-
NSData* jpgData = UIImageJPEGRepresentation(capturedImage, 1.0f);
83+
NSData* jpgData = UIImageJPEGRepresentation(capturedImage, .8f);
8484
NSString* encodedData = [jpgData base64EncodedStringWithOptions:0];
8585

8686
// Fire the onSnapshotDataReturned event if hooked up.

0 commit comments

Comments
 (0)