When you add image watermarks using Image Processing (IMG), a request fails with an invalid pre-processing parameter error if the Base64-encoded image parameter decodes to a value that contains /watermark.
Problem description
An invalid pre-processing parameter error occurs when adding image watermarks using the IMG service.
Causes
The image parameter in x-oss-process must be a Base64-encoded URL that points to the watermark image file. If the decoded value contains /watermark, IMG treats this as nested watermarking, which is not supported, and rejects the request.
Examples
The following request triggers the error:
GET /example_image?x-oss-process=image/watermark,image_cGFuZGEucG5nP3gtb3NzLXByb2Nlc3M9aW1hZ2Uvd2F0ZXJtYXJrLGltYWdlX2NHRnVaR0V1Y0c HTTP/1.1
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
Date: Fri, 03 Feb 2023 03:41:49 GMT
Content-Type: application/xmlThe request fails because the image parameter decodes to a value that contains /watermark:
| Value | Content |
|---|---|
Base64-encoded image parameter | image_cGFuZGEucG5nP3gtb3NzLXByb2Nlc3M9aW1hZ2Uvd2F0ZXJtYXJrLGltYWdlX2NHRnVaR0V1Y0c |
| Decoded value | panda.png?x-oss-process=image/watermark,image_cGFuZGEucG |
The decoded value contains /watermark, which IMG interprets as a nested watermarking instruction.
Solutions
Base64-encode only the plain URL of the watermark image file. The decoded value must not contain /watermark.