Format • fm
The image format for the final image (e.g. JPEG, PNG)
Values: png
, jpg
, webp
, json
png
The format uses lossless compression and is generally considered the replacement to the GIF image format. It support transparency.
jpg
JPG files are a lossy compression format, which means it significantly reduces the size of the file. This is not so good for flat images, but great for photographs. However, JPG compression also reduces the quality of the image, which might be noticeable if it's highly compressed. You can adjust the quality via the q parameter.
webp
This format can be either lossy or lossless, and supports transparency. It is about 25% better at compression than JPG (lossy) and PNG (lossless), however not all browsers support webp.
json
This is a data representation, in JSON, of your original image. Here is a sample JSON document from a JPG image:
{
"format": "jpeg",
"size": 830452,
"width": 2311,
"height": 1851,
"space": "srgb",
"channels": 3,
"depth": "uchar",
"density": 72,
"chromaSubsampling": "4:2:0",
"isProgressive": false,
"hasProfile": false,
"hasAlpha": false,
"iptc": {
"type": "Buffer",
"data": [
80,
104,
111,
116,
111,
'...'
]
}
}
Format negotiation
OMGIMG will automatically choose another format if your customer's browser can't display a webp
, and you set the fm=webp.
You can also ask OMGIMG to automatically choose the webp
format if the browser is able to display it if you say set fm=jpg. You can do so by setting the auto=fm option.