Processing an Image
API Description
You can use this API to process images in a stable, secure, efficient, easy to use, and cost-effective manner. If the object to be downloaded is an image, you can pass the image processing parameters to process the image, including cutting and resizing it as well as putting a watermark and converting the format.
For more information, see the Image Processing Feature Guide.
Method Definition
func (obsClient ObsClient) GetObject(input *GetObjectInput) (output *GetObjectOutput, err error)
Method Definition If a Signed URL Is Used
func (obsClient ObsClient) GetObjectWithSignedUrl(signedUrl string, actualSignedRequestHeaders http.Header) (output *GetObjectOutput, err error)
Request Parameters
| Field | Type | Optional or Mandatory |
|---|---|---|
| input | Mandatory |
Returned Results
| Field | Type |
|---|---|
| output | |
| err | error |
Sample Code
func main() { input := &obs.GetObjectInput{} input.Bucket = "bucketname" input.Key = "objectname" // Resize and rotate the image in sequence. input.ImageProcess = "image/resize,m_fixed,w_100,h_100/rotate,90" // Download an object. output, err := obsClient.GetObject(input) if err == nil { defer output.Body.Close() fmt.Printf("ETag:%s\n", output.ETag) } else if obsError, ok := err.(obs.ObsError); ok { fmt.Printf("Code:%s\n", obsError.Code) fmt.Printf("Message:%s\n", obsError.Message) } }
- Use GetObjectInput.ImageProcess to specify the image processing parameters.
- Image processing parameters can be processed in cascading mode. This indicates that multiple commands can be performed on an image in sequence.
Last Article: Obtaining Customized Metadata
Next Article: Restoring Archive Objects
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.