You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 2, 2023. It is now read-only.
I want to create small small images as I am annotating any image and want to render all those pieces independently on the web page.
For example, refer attached image which I have annotated with 3 shapes. Now I want to save these 3 shapes independently on the server so that I can serve them independent of an original image.
Let me know if this is possible with Annotorious.
Really good work!
The text was updated successfully, but these errors were encountered:
It is a solution for you. Just create a canvas and export it as an image.
letimage=document.getElementById('YOUR_IMG_ID');let{ naturalWidth, naturalHeight }=image;letcanvas=document.createElement('canvas');canvas.width=image.naturalWidth;// use the original sizecanvas.height=image.naturalHeight;letcontext=canvas.getContext('2d');context.drawImage(image,0,0,naturalWidth,naturalHeight);anno.getAnnotations().forEach(item=>{let{ x, y, width, height }=item.shapes[0].geometry;context.shadowOffsetX=3;context.shadowOffsetY=3;context.shadowBlur=3;context.shadowColor='rgba(255, 255, 255, 0.5)';context.strokeStyle='#131313';context.lineWidth=3;context.globalCompositeOperation='source-in';// it is key pointcontext.fillRect(x,y,width,height);// fillRect or strokeRect}letbase64=canvas.toDataURL('image/jpeg',0.7);base64=base64.replace(/^data:image\/\w+;base64,/,'');base64=atob(base64);letcount=base64.length;letu8arr=newUint8Array(count);while(count--){u8arr[count]=base64.charCodeAt(count);}letfile=newFile([u8arr],'output.jpg',{type: 'jpeg'});letform=newFormData();form.append('file',file);axios.post('/YOUR_API_URL',form);
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hi,
I want to create small small images as I am annotating any image and want to render all those pieces independently on the web page.
For example, refer attached image which I have annotated with 3 shapes. Now I want to save these 3 shapes independently on the server so that I can serve them independent of an original image.
Let me know if this is possible with Annotorious.
Really good work!
The text was updated successfully, but these errors were encountered: