Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

245
Visualizações
Javascript Canvas, resize image

I wonder how to use canvas in JS. I have the following questions:

  1. Let's say I have inputted an image and on my page I can access its src of blob (as far as I know this is the best way to get the image dynamically):
<img ... src="blob...">

Now I want to get this image in my JS and then modify it (resize and so on). Is blob src enough to do that?

  1. When I'll resize the image with canvas, where to store that resized image? In input tag's value attribute or what? What's the best practice to resize image on front before sending it via network? That input is in my form as I want to send that resized image to my server, and not to overflow my network.

  2. Also, is it possible to paste a watermark on that image with JS?

Hope you got it, and huge thanks in advance!

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You can download and store your image as an Image object, it's not necessary to have it in your html.

You can draw it on a canvas using drawImage function, which let you draw the image with the proportion of your choice. You can use the same function to draw a watermark on the canvas.

Once you are happy with the image on the canvas you can get it as a blob using toBlob function and upload to your server

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda