BenJeau / react-native-draw

SVG based data-driven React Native drawing component 🎨
https://www.npmjs.com/package/@benjeau/react-native-draw
MIT License
127 stars 42 forks source link

Function which return bitmap image in base64 format. #53

Closed Anubhavshakya closed 2 years ago

Anubhavshakya commented 2 years ago

Is your feature request related to a problem?

No response

Desired solution (feature)

I am able to convert the svg into base64 but I need a bitmap image as a base64 format.

Alternatives considered

No response

Anything else?

No response

BenJeau commented 2 years ago

I don't intend on adding rasterization support for this library, since this is something I'm unsure of how it works. But if you find a way on how to do it, I would gladly accept a PR or add it to the README :)

I see three ways to accomplish this:

  1. React Native view capture, like this library https://www.npmjs.com/package/react-native-view-shot

Or rasterize the svg to a png (or other format) with something like https://www.npmjs.com/package/svg-png-converter, in

  1. React Native (although I am unsure if these libs would work in React Native) there must be a way to rasterize svg's in React Native, but do not know of a way
  2. In a server, requesting the conversion and doing the conversion on the server
Anubhavshakya commented 2 years ago

Yes, React native view capture solved my problem.