react-pdf icon indicating copy to clipboard operation
react-pdf copied to clipboard

Add webp support

Open quanvu1204 opened this issue 4 years ago • 9 comments

Being able to load webp images

quanvu1204 avatar Apr 23 '21 04:04 quanvu1204

bumping this 🙏

lucassshanks avatar Dec 06 '22 09:12 lucassshanks

I'd be up for working on this if someone can point me in the right direction and the maintainers of the project are okay with webp support being added.

It looks like a webp equivalent of image/src/jpeg.js and image/src/png.js would need to be created and then integrated into resolve.js. It seems the first step for doing that would be to find a jb lib with the desired webp related functionality? @diegomura thoughts?

BStephenBB avatar Dec 12 '22 21:12 BStephenBB

@BStephenBB I would love webp support of course!

The approach you mentioned is what I would've suggested. When finding (or building) a webp js lib we should be very careful about how much code it introduce to the lib

diegomura avatar Dec 15 '22 20:12 diegomura

@diegomura have you or anyone else put any work into this? I wouldn't mind having a crack at it if there isn't already someone on the task

babyccino avatar Oct 14 '23 23:10 babyccino

I have not. Sorry

diegomura avatar Oct 14 '23 23:10 diegomura

@babyccino Are you working on this?

imyasha avatar Dec 16 '23 22:12 imyasha

@babyccino Are you working on this?

No I've never had enough free time to have a go at it. Would be greatly appreciated if it was done though 👍

babyccino avatar Dec 17 '23 03:12 babyccino

@babyccino @diegomura I hit a PR for this issue please review this one when you have a min. https://github.com/diegomura/react-pdf/pull/2463

imyasha avatar Dec 17 '23 22:12 imyasha

Per https://github.com/foliojs/pdfkit/issues/1497 Pdfkit can't support webp because PDFs themselves don't support webp. You'll need to convert to a supported image format first 😕

fasiha avatar Jun 05 '25 22:06 fasiha