Pdfimages seems to only extract images with transparency from PDFs by downloading it alongside the image mask. You can probably use something like ImageMagick if you only have a couple of images to convert it back into a PNG with transparency, but since there was a lot of images in my case, this is the script I used.
It uses pdf.js and sharp. Sharp was probably overkill but it makes the exporting part a bit cleaner.