Is there a general way how to specify the "image compression loss"? For JPG, i can choose the "quality" from 100 to 0, which means that any pixel information is divided by 1 (quality = 100) or a very high number (quality = 0).
This results in less or more "artifacts", which are regions of the same color. The sizes of that regions depend on the image content and the selected "quality level".
But there are other compression formats using other algorithms. The common characteristic is that the resulting image has less information than the original uncompressed data. 

Is there any way to specify those losses independently from both the used file format and the image content?
First off, it's worth noting that not all artefacts are regions of the same colour. Artefacts just means structured errors introduced by the compression, as opposed to noise or blurring. JPEG artefacts include flattened colours as you mention, but also edges introduced at block boundaries, and "ringing" around sharp edges in the image.

There are two popular metrics for specifying the losses, but they're not independent of the image content, and they measure the whole loss, not just structured artefacts. PSNR is most commonly used to quantify the loss of image and video compression algorithms. It's not a very useful measure, because it measures the absolute reconstruction error: it doesn't take into account what kind of artefacts are introduced and how they appear. Structural similarity (SSIM) is better because it takes the structure of the image and the errors into account in the measure.

The measure can't be independent of the image, for several reasons. Different images are easier or harder to reconstruct. For example, a completely flat colour will be perfectly reconstructed even with some very lossy algorithms and parameters. At the opposite end, completely random white noise will suffer some loss in almost any algorithm. Some images just contain more information than others. In addition, different domains have different requirements, so algorithms can be tuned for different kinds of images. JPEG is tuned for photographs, and performs badly on hard-edged synthetic images like diagrams. A texture compression algorithm might be tuned specifically to avoid block artefacts for tileable textures. JBIG2 is tuned for black-and-white document scans. A single generic measure wouldn't help you to understand the performance of the algorithm on the kind of image you're interested in.

To get a broader measure, it's common for researchers to quote a mean PSNR and/or SSIM measured across a corpus of images. The Kodak PCD0992 corpus has been used for many years, so it's an easy way to compare different papers, but it is waning in popularity now.