Is it possible to losslessly crop/scale a webp similar to jpegtran

514 views Asked by At

Jpegtran allows fast lossless cropping and scaling of jpegs with certain constraints.

Is there a similar tool to do the same for webp files? I couldn't find one.

Is it even possible?

2

There are 2 answers

1
Aryn Thernium On

Not easily. WebP doesn't encode the same way as JPEG, so it's not the same process. According to the WebP docs, "VP8 intra-prediction modes are used with three types of macroblocks: 4x4 luma, 16x16 luma, 8x8 chroma". But it's not the same process as JPEG, so the methods applied to JPEGs for "lossless" cropping couldn't be applied. There don't exist any tools that I've found that can do this, so if you wanted one to do it out of the box you'd have to write it yourself.

For now, try this: https://www.resizepixel.com/crop-image/ As far as I can tell, it does pretty alright at cropping WebP images with minimal, if any, compression artefacts.

0
cachius On

You should ask this on the WebP Discussion forum:

This is the place to ask everything about WebP, the image compression format.

Probably there are just a few dozens of people who can answer this thoroughly and chances are high to meet some of them there.

Lossless vs reencode-less

Jpeg only has lossy compression, so every reencoding will lose some information. WebP has lossless mode, in which reencoding won't lose information. Nonetheless you could possibly avoid time-consuming reencodings on certain operations like cropping, mirroring, grayscaling in a way similar to jpegtran. So to make your point clear ask for reencode-less webptran for fast cropping and scaling of lossless and lossy webps, like jpegtran for jpegs.

The fact that neither webptran nor aviftran nor heictran are available makes you wonder wether they're considered unneccessary, too complicated or are simply impossible.