axe312ger / sqip

"SQIP" (pronounced \skwɪb\ like the non-magical folk of magical descent) is a SVG-based LQIP technique.

Home Page:http://axe312ger.github.io/sqip

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

webp / heif support

wereHamster opened this issue · comments

Can't use webp or heif images as input images, because it's not supported by node vibrant -> jimp dependency.

I'm not actually interested in the dominant colors though, only in the svg output. It would be nice if the whole code which extracts the dominant colors wouldn't run at all unless I activate it (as a plugin for example). The plugins I currently use are sqip-plugin-primitive, sqip-plugin-blur, sqip-plugin-svgo.

Hi,

great request. I suggest we do the following:

  • by default: try to transform the image to a forma that vibrant understands, probably using sharp.
  • add option to disable the color palette generation

I have to maintain this repo on low priority, but will have a look into this. We currently prepare a ts rewrite, push out a first beta and then can start adding more features/fixing bugs and getting ready for a v1 stable.

Will keep u posted, just can't promise any timespan.

Cheers

AFAICS sharp is already a dependency, so wrapping the buffer in sharp().png() wouldn't add too much additional cost, correct? If so, I can try the PR.

Alternative would be to run .png() only when we detect an incompatible image format (jimp currently supports png/jpeg/bmp/tiff/gif).

I'd vote that we try it with node vibrant, if it fails, we make a png out of it with sharp and try again. If second try fails, we actually throw an error.

PRs are very welcome :)

Uhh nice thanks!

This is done and released in the v1@canary