Changing Image Quality
You can edit code on OBS Console or make an API call to change the quality of an image.
To save space, you can compress JPG images. Table 1 describes the parameters.
This operation is represented by quality.
Parameter |
Value Description |
Code Example |
---|---|---|
q |
Relative quality of the image. The image is compressed to q% of the original. The value ranges from 1 to 100. Formula for compression: Target quality = Original quality × q% For example, if the original image quality is 100% and the relative quality is 80%, then the target image quality is 80%. If the original quality is 80% and the relative quality is 80%, then the target quality is 64%. |
image/resize,w_100,h_100/quality,q_80 |
Q |
Absolute quality of the image. The image is compressed into Q%. Q is irrelevant to and does not depend on the original image. The value ranges from 1 to 100. Formulas for compression:
For example, if the original image quality is 100% and the absolute quality is 80%, then the target image quality is 80%. If the original quality is 70% and the absolute quality is 80%, then the target quality is 70%. |
- q is valid only for JPG images.
- If both q and Q are used, the output is based on Q.
Examples
- Resize the image by setting the height and width both to 100 and generate a JPG image with a relative quality of 80%.
- Resize the image by setting the height and width both to 100 and generate a JPG image with an absolute quality of 80%.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot