trimPNG is a TypeScript function to remove transparent pixels from the borders of images
npm install trimpng
yarn add trimpng
import trimPNG from 'trimpng';
const imageElement = document.getElementsByTagName('img')[0];
const trimmedImageDataURL = trimPNG(imageElement);
imageElement.src = trimmedImageDataURL;
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.