P
P
PigData2019-09-28 16:08:18
assembler
PigData, 2019-09-28 16:08:18

Chrome extensions: how to get image data?

How to get the image data of the picture on which the context menu was called (for subsequent sending to a third-party site)? I'm interested in getting "data", not the url of the picture.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander, 2018-05-29
@NeiroNx

Go through the digits, writing down the value of each digit. If it were hexadecimal then it would be possible to get by with bit shift and mask operations.
Find the remainder of division by 10 , write the character as the value of the character "0" plus the value of the remainder.
Convert the memory address for writing the string down. Then divide by 10 if it is greater than zero then repeat the cycle otherwise exit.

R
Roman, 2019-09-28
@GTech

data to base64 ?

const toDataURL = url => fetch(url)
  .then(response => response.blob())
  .then(blob => new Promise((resolve, reject) => {
    const reader = new FileReader()
    reader.onloadend = () => resolve(reader.result)
    reader.onerror = reject
    reader.readAsDataURL(blob)
  }))


toDataURL('https://www.gravatar.com/avatar/d50c83cc0c6523b4d3f6085295c953e0')
  .then(dataUrl => {
    console.log('RESULT:', dataUrl)
  })

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question