Saving Images
Hello and thanks for your work.
I would like to ask what is the suggested way of saving a drawn image, for example using a submit button.
Thank you.
I did this for another project I was working on, saved an html canvas to png. If it's not implemented yet I could c + p that code over in 2 weeks when I get back from vacation.
Hi wmaillard, i would like to have the code if you may. Thanks in advance
Hello.
You can check my project that allows you to identify drawn logos using Google's cognitive services: https://github.com/Alekos92/logo-identification-with-google
The functionality you are interested in can be found in the src/State.ts file.
Regards, Alex
Ability to save would be amazing
This helped me to save my image.
Ref to sketch component:
<SketchField
tool={checkFillFigures}
lineColor={drawerParams.color}
lineWidth={drawerParams.strokeWidth}
ref={(view) => {
imageCaptureRef = view
}}
fillColor={checkFillColor}
/>
And call of undocumented component method:
const result = await viewRef.toDataURL({
format: 'base64',
quality: 0.5,
width: 480,
height: 320,
})
setRequestImage(result.substring(22))
// setRequestImage(result.replace('data:image/png;base64,',''))