gre / gl-react

gl-react – React library to write and compose WebGL shaders

Home Page:https://gl-react-cookbook.surge.sh

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

.glView.capture problems when capturing Surface

luigbren opened this issue · comments

until I added this configuration this.SurfaceRef.glView.capture({ format: "jpg" }) and nothing, it doesn't do what I want, always returns the same .jpeg extension..
I receive this data to add effects, in this example Valencia.js

[{"height": 200, "mime": "image/jpeg", "uri": "file:///storage/emulated/0/Pictures/b9494198-ea75-4d19-8c98-406632f6b65f.jpg", "width": 300}]

I process the Valencia Filter and any other... and I get this result back

const result = await this.SurfaceRef.glView.capture({ format: "jpg" });

{"height": 720, "localUri": "file:///data/user/0/com.myapp/cache/GLView/500d5b7e-c3c8-4937-a27e-1a3bd5bd1830.jpeg", "uri": "file:///data/user/0/com.myapp/cache/GLView/500d5b7e-c3c8-4937-a27e-1a3bd5bd1830.jpeg", "width": 1080}

https://github.com/beqaweb/gl-react-native-filters/blob/master/filters/Valencia.js

apart from changing the resolution of the file, it also changes the extension.. from .jpg to .jpeg

Why does that happen?

.jpg and .jpeg are synonym extensions.

Under the hood, gl-react is simply exposing GLView.takeSnapshotAsync https://docs.expo.io/versions/v40.0.0/sdk/gl-view/#glviewtakesnapshotasyncgl-options
which is probably the reason of this behavior. If this really is an issue, please contact Expo.