Skip to content

Latest commit

 

History

History

docs

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

documentation

a quick guide on how to use imgrgba as a library.

basic usage

<script src='https://often.github.io/imgrgba/lib.js'></script>
<script>
   const img = document.createElement('img')
   img.src = '...'
   // img.crossOrigin = ''
   // ^ you might want to do this, read more here: https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image
   
   img.addEventListener('load', () => {
      console.log(img.getRgba()) // => [r, g, b, a]
      // console.log(getRgba(img))
      // ^ or like so
      // ...
   })
</script>

ESM usage

import { getRgba } from 'https://often.github.io/imgrgba/lib.esm.js'

// from here, use the `getRgba` function
// ...