R
R
rinaz222018-07-24 23:21:09
JavaScript
rinaz22, 2018-07-24 23:21:09

Is it possible to know the size in bytes of an image created with convas?

Hello! Is there any way to find out the size of an image in bytes created with canvas?
For example: I created a smiley, you need to determine the size of this smiley in bytes.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir Proskurin, 2018-07-24
@rinaz22

The image is drawn in the canvas as is, in bitmap, without compression (Png / jpg and others). Therefore, feel free to use the formula
width*height*4
where 4 is RGBA
Well, or you can get from toDataURL("image/png") and find out the size there

S
Sergey delphinpro, 2018-07-25
@delphinpro

The size of this emoji in bytes will depend on what format you save it in.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question