Read the rules before proceeding!

e621:image quality (locked)

This is an attempt to clarify how image quality works, and how file size, compression levels, compression formats, and similar things affect the over all visual quality.

Table of Contents:

1. What is visual quality
2. What is image compression
2.5 Lossy Compression vs lossless compression
3. Why file size is not an acceptable metric for quality
4. How to judge image quality for yourself
5. Resolution, and why bigger is usually better but not always
5.5 Tutorial on how to compare images
6. What this means for videos

What is visual quality:

With image quality we say how well the file in question preserves the drawing / render that the artist made. The lower the visual quality the worse preserved is the original file. On other hand a high (or perfect) visual quality simply indicates the image is as close to the artist's original creation as possible.
Lossy image compression (expanded on further down) discards valuable information and alters the image. These alterations are what decreases quality. Lines are less sharp, small details are lost entirely, contrast decreases, the image's colors dull and get simpler. Simply put the image no longer matches what the artist created.

What is image compression:

Images are compressed so they take up less space on a hard drive and are quicker to transfer over networks or from drive to drive. There are many ways information can be compressed, and different tools suit different needs. The most common image compression methods in use today are jpg, png, and gif.

Opposite of those compressed file types are the uncompressed, or more precisely raw, file types like bmp and RAW. We don't accept raw images so those file types are of no concern to us. Needless to say, bmp and RAW files have a much larger file size than their compressed counterparts.

Lossy compression vs lossless compression:

Lossy compression means the file size is reduced by discarding superfluous information from the image itself. JPG is a lossy compression format and does precisely this: It outright deletes and simplifies the image. As a result the original file is irreversibly altered and no longer visually matches the original.

Lossless compressions function by looking for redundancies in the file itself, and then shortening this redundant information. PNG does precisely this, and by only modifying redundant information the original image is preserved perfectly. This means by using a PNG compression from the start the image itself is preserved exactly as the artist created it.

Saving a JPG as PNG:

Saving a JPG file as PNG does not improve the quality of the image and is pointless to do. All this does is preserve an already altered copy of the image. Turning a JPG into a PNG does not (and can not) reverse damage done by the jpg compression, all it does is preserve the jpg compression.

Why file size is not an acceptable metric for quality:

Image files are made up of multiple parts. Usually a header which includes what type of file it is, some exif data (more on that further down), then the actual body of the file containing the image data. Many pages on the internet keep the body intact but may alter the header and contained exif data, or outright strip that information entirely.
The exif data usually contains information such as program used to create the image, geographical location where the image was made (in case it was a photo), sensor information (if it was a photo), color profile (JPG and PNG), DPI (Dots per inch), and more.
Especially the rampant modification of the exif data means that filesize can vary greatly even if the same image has been uploaded to different pages. Usually when an image looks the same but has different sizes the reason is that the exif data has been tampered with.

PNG only: PNG supports different levels of compression, while a PNG file can thus range in size the image contained within is exactly the same at all times. Thus we will only keep the first uploaded png version, as long as they're otherwise identical.

Resolution, and why bigger is usually better but not always:

Resolution can refer to two things when it comes to images: Absolute dimensions and DPI/PPI (Dots per Inch, Pixel per Inch).

Absolute Dimensions simply refers to how many pixels are in the vertical and horizontal axis in total.
PPI/DPI mean how many pixels are in any given inch and is mainly of interest for printing purposes, and thus largely irrelevant for us.

For reference most consumer grade 1080p displays have absolute dimensions of 1,920 by 1,080 pixels and a DPI of 72.

What does this mean?

Usually when we say bigger is better we mean we want the original size the artist saved the image as. The resolution of this original will preserve most of the details and will have the least amount of editing done to it.

However, with the rise of programs like waifu2x bigger isn't always better. An image scaled up with waifu2x will decrease in visual quality. Since it's trivial to upscale images via waifu2x we do not allow these types of images. People can create those for themselves as they see fit.

How to judge image quality for yourself:

The best way to judge an image's quality is to look at the fine details of it. JPG compression is especially visible in high-contrast areas and in the color red. Thus, the best place to look at in any image is near linework where black and white directly border at each other, or where there is the color red.

Below are a bunch of example files of the same image at different compression levels.

PNG with perfect lossless compression: GDrive
JPG with 100% quality: GDrive
JPG with 90% quality: GDrive
JPG with 50% quality: GDrive
JPG with 1% quality: GDrive

All of the above images have been saved as jpg, then saved as PNG to preserve the compression and allow some more demonstrative alterations.
As you can see the quality degrades with every single image. Colors get washed (especially visible in the black hair with the blue shading) even at 100% quality. This gets worse with noise (those random blocky colors near black lines) the worse the quality becomes.
While seldom used anymore the 1% quality demonstrates most clearly how JPG compression works: It simplifies the image down to it's barest information and just leaves a shell.

Tutorial on how to compare images:

If you wish to compare two images with each other download both, and overlay them in art program of your choice. Set one of the two layers to "Difference" and then look for highlighted areas. If a pixel is the same in both images the pixel will be black. If the images do not match those areas will be colored.
This means if the overlay produces a perfectly black image they are identical. If you can see color the two images are different. Of the two images the one with less jpg artifacts is the preferred version for us.

You can find a step by step tutorial (with pictures) here.
The image editing program used is the free Paint.net, which can be downloaded here.

What this means for videos:

Since videos are technically just a bunch of still images being shown to you at a high speed the same above applies for videos as well. However videos use some slightly different compression algorithms and thus the compression in videos looks different than the ones found in still images.