r/reactnative • u/Miserable-Pause7650 • 8d ago
Should I convert from jpeg to webp for images saved in expo-file-system and firebase storage?
Seems like webp images are 30% smaller and offers no quality reduction, so should I convert to webp first before saving to reduce storage and increase speed?
For context, images would be photos uploaded by users
0
Upvotes
4
u/davidbalbino 7d ago
tbh the format is the smaller win here. user photos come straight from the camera at like 4000px and a few MB, so resizing before upload saves way more than jpeg -> webp alone
expo-image-manipulator does both in one step:
then upload out.uri. if you'd rather not touch it on the device, the Firebase Resize Images extension can generate webp versions server side. I think is worth keeping the original only if you really need full res later
2
u/Western_Cap_6934 8d ago
WebP can help, but the often-quoted 25-34 percent saving is for lossy encoding at comparable SSIM, not lossless conversion. Re-encoding a JPEG as lossy WebP can add artifacts. Compare actual uploads at the same dimensions and acceptable quality before converting everything, and include the encoding time in your speed comparison.
1
u/Miserable-Pause7650 5d ago
Thanks guys, updated my revenue cat package and now its all good :) Your advices helped me realize its revenue cat by looking at the config file generated
1
u/MobileXapps 8d ago
Resize before you think about the format. A phone photo is often 4000px wide and 3-5 MB, and if you show it at 1080px at most, scaling it down first saves far more than the JPEG to WebP switch.
I'd keep JPEG at a sensible quality after resizing, unless you're sure every place that reads these files handles WebP. If you want a thumbnail for lists, save a small one next to the full image instead of loading the big one everywhere.
1
u/anthony-ball 7d ago
For user photos the format matters less than the size. Most of the savings come from not uploading the 12MP camera original. Resize to around 1600-2000px on the long edge with expo-image-manipulator and compress around 0.7-0.8, and you're usually down to a few hundred KB. The manipulator can also save as webp, so since you're re-encoding anyway you don't pay for a second lossy pass by picking webp over jpeg. Just make sure everything else that reads those files, like a web admin, emails or thumbnails, handles webp.
2
u/MortgageMelodic2282 8d ago
Is not doing it a problem? If so yes. If not no
2
u/therealswood2 8d ago
That is certainly an option.
Should you? How should we know?