Use png when your image has sharp corners (text, graphics, etc.). Use jpg for photos etc…
They are two different formats made for different purposes. (You will get the block-artifacts in jpg when using sharp corners and high compression, using png for camera-pictures will create large files).
Or use a modern format like webp or jpgxl, but some devices don’t support these formats so most things online are still jpg/png.
And if you have a vector image instead of raster use svg



I use ente.io, afaik you can selfhost it but I’m sticking with their subscription since I don’t trust myself with my backup strategy ^^"
It also has an “event”-feature where you can share an album-link and people without an account/the app can upload images to the album