All Products
Search
Document Center

Image Search:.Net SDK

Last Updated:Jan 21, 2026

This topic describes how to use the .Net SDK for Image Search and provides examples.

API list

API name

Description

Add

Adds an image.

SearchImageByPic

Searches for similar images using an image.

SearchImageByName

Searches for similar images using a specified image that is in the image database.

Delete

Deletes an image.

UpdateImage

Modifies an image.

Detail

Queries instance information.

DumpMeta

This is a metadata export task.

DumpMetaList

Lists metadata export tasks.

BatchTask

Batch Job

BatchTaskList

Lists batch tasks.

CompareSimilarByImage

Compares the similarity of two images.

Preparations

Before you install and use the Alibaba Cloud SDK, you need to register an Alibaba Cloud account and create an AccessKey pair. For more information, see Create an AccessKey pair.

  1. In the Solution Explorer pane, right-click your project and select Manage NuGet Packages.

  2. In the NuGet management pane, click the Browse tab and enter AlibabaCloud.SDK.ImageSearch20201214.

  3. Click Install.

Add API

  • Code sample

    using AlibabaCloud.OpenApiClient.Models;
    using AlibabaCloud.SDK.ImageSearch20201214.Models;
    using AlibabaCloud.SDK.ImageSearch20201214;
    using AlibabaCloud.TeaUtil.Models;
    using System;
    using System.IO;
    namespace Test
    {
        class Add
        {
            static void Main(string[] args)
            {
                // Console.WriteLine("Hello World!");
                // For more information about how to create an AccessKey pair, see https://www.alibabacloud.com/help/en/ram/user-guide/create-an-accesskey-pair
                Config config = new Config();
                // An AccessKey pair of an Alibaba Cloud account has all permissions on the API. We recommend that you use a RAM user to call the API or perform routine O&M.
                // We strongly recommend that you do not save the AccessKey ID and AccessKey secret in your project code. Otherwise, the AccessKey pair may be leaked and threaten the security of all resources in your account.
                // This example shows how to save the AccessKey ID and AccessKey secret in environment variables. You can also save the AccessKey pair in a configuration file as needed.
                IDictionary environmentVariables = Environment.GetEnvironmentVariables();
                foreach (DictionaryEntry de in environmentVariables)
                {
                    if (de.Key.Equals("CC_AK_ENV")) {
                        config.AccessKeyId = (string)de.Value;
                    }
                    if (de.Key.Equals("CC_SK_ENV"))
                    {
                        config.AccessKeySecret = (string)de.Value;
                    }
                }
                config.Endpoint = "imagesearch.ap-southeast-1.aliyuncs.com";
                config.RegionId = "ap-southeast-1";
                config.Type = "access_key"; 
    
                // The following code shows how to access the service over a VPC.
                // Note: You can access the service over a VPC only from an ECS instance or a resource that is in the same region as the Image Search instance. For example, if your Image Search instance is in the Singapore region, your ECS instance or resource must also be in the Singapore region to access the Image Search service over a VPC. Otherwise, the call fails. If the call fails, check whether your ECS instance or resource is in the same region as the Image Search instance.
                // config.EndpointType = "internal";  // If you access the Image Search service over a private network, you must set the endpointType parameter. Set the value to "internal".
                // config.Endpoint = "imagesearch-vpc.ap-southeast-1.aliyuncs.com"; // This is a private endpoint. Replace it with the endpoint of the region where your instance is located. For example, if your instance is in the Singapore region, set the endpoint to "imagesearch-vpc.ap-southeast-1.aliyuncs.com".
                
                Client client = new Client(config);
                FileStream fs = File.OpenRead("D:/111.jpg");
                AddImageAdvanceRequest request = new AddImageAdvanceRequest();
                // Required. The name of the image. The name can be up to 256 characters in length.
                 // 1. An image is uniquely identified by the combination of ProductId and PicName.
               // 2. If you add an image with the same ProductId and PicName multiple times, the existing image is overwritten.
                request.PicName = "xusong.jpg";
                // Required. The product ID. The ID can be up to 256 characters in length.
                // A product can have multiple images.
                request.ProductId = "1001";
                // Required. The name of the Image Search instance. Note that this is the instance name, not the instance ID. After you purchase an instance, you can view the instance name in the instance information on the overview page of the Image Search console: https://imagesearch.console.alibabacloud.com/overview
                request.InstanceName = "XXXXXXXXXXXXXXXXXXXXXXXXX";
                // The image content. The image can be up to 4 MB in size. The transfer timeout period is 5s. The following image formats are supported: PNG, JPG, JPEG, BMP, GIF, WEBP, TIFF, and PPM.
                // For product and generic image search, the image must be at least 100 pixels in height and width, and at most 4096 pixels in height and width.
                // The image cannot contain rotation information.
                request.PicContentObject = fs;
                // Optional. The integer attribute. You can use this attribute to filter images during a search. This field is returned in the query results.
                //  For example, you can set different IntAttr values for images from different sites or users to isolate them during a search.
                request.IntAttr = 99;
                 // Optional. The string attribute. The attribute can be up to 128 characters in length. You can use this attribute to filter images during a search. This field is returned in the query results.
                request.StrAttr = "aliyun.com";
                // Optional. The image category.
                // 1. For product search: If you set a category, the specified category is used. If you do not set a category, the system predicts the category. The predicted category is returned in the response.
                // 2. For generic search: The system sets the category to 88888888, regardless of whether you specify a category.
                request.CategoryId = 5;
                // Optional. Specifies whether to enable subject identification. The default value is true.
               // 1. If you set this parameter to true, the system performs subject identification and searches for the identified subject. The subject identification result is returned in the response.
                //  The specified region cannot exceed the image boundaries.
               // 2. If you set this parameter to false, the system does not perform subject identification and searches for the entire image.
                request.Crop = true;
                // Optional. The subject region of the image. The format is x1,x2,y1,y2. (x1, y1) are the coordinates of the upper-left corner, and (x2, y2) are the coordinates of the lower-right corner.
               // If you specify the Region parameter, the system searches for the specified region, regardless of the value of the Crop parameter.
                request.Region = "66,333,97,356";
                RuntimeOptions runtimeObject = new RuntimeOptions();
                try
                {
                    AddImageResponse response = client.AddImageAdvance(request, runtimeObject);
                    Console.WriteLine("result:" + Newtonsoft.Json.JsonConvert.SerializeObject(response));
                }
                catch (TeaUnretryableException e)
                {
                    Console.WriteLine("InnerException result:" + e.InnerException.Message);
                    Console.WriteLine("Data result:" + e.Data);
                    Console.WriteLine("Message result:" + e.Message);
                    Console.WriteLine("Print String:" + e.ToString());
                }
            }
        }
    }
  • Sample result

    result:{"Headers":{"date":"Mon, 11 Jan 2021 06:57:16 GMT","connection":"keep-alive","access-control-allow-origin":"*","access-control-allow-methods":"POST, GET, OPTIONS","access-control-allow-headers":"X-Requested-With, X-Sequence, _aop_secret, _aop_signature","access-control-max-age":"172800","x-acs-request-id":"6D32C931-D584-4927-938A-6053AE9B630D"},"Body":{"Message":"success","RequestId":"6D32C931-D584-4927-938A-6053AE9B630D","Code":0,"PicInfo":{"Region":"112,440,76,387","CategoryId":88888888},"Success":true}}

SearchImageByPic API

  • Code sample

    using AlibabaCloud.OpenApiClient.Models;
    using AlibabaCloud.SDK.ImageSearch20201214.Models;
    using AlibabaCloud.SDK.ImageSearch20201214;
    using AlibabaCloud.TeaUtil.Models;
    using System;
    using System.IO;
    namespace Test
    {
        class SearchImageByPic
        {
            static void Main(string[] args)
            {
                Config config = new Config();
                // For more information about how to create an AccessKey pair, see https://www.alibabacloud.com/help/en/ram/user-guide/create-an-accesskey-pair
                // An AccessKey pair of an Alibaba Cloud account has all permissions on the API. We recommend that you use a RAM user to call the API or perform routine O&M.
                // We strongly recommend that you do not save the AccessKey ID and AccessKey secret in your project code. Otherwise, the AccessKey pair may be leaked and threaten the security of all resources in your account.
                // This example shows how to save the AccessKey ID and AccessKey secret in environment variables. You can also save the AccessKey pair in a configuration file as needed.
                IDictionary environmentVariables = Environment.GetEnvironmentVariables();
                foreach (DictionaryEntry de in environmentVariables)
                {
                    if (de.Key.Equals("CC_AK_ENV")) {
                        config.AccessKeyId = (string)de.Value;
                    }
                    if (de.Key.Equals("CC_SK_ENV"))
                    {
                        config.AccessKeySecret = (string)de.Value;
                    }
                }
                config.Endpoint = "imagesearch.ap-southeast-1.aliyuncs.com";
                config.RegionId = "ap-southeast-1";
                config.Type = "access_key"; 
    
                // The following code shows how to access the service over a VPC.
                // Note: You can access the service over a VPC only from an ECS instance or a resource that is in the same region as the Image Search instance. For example, if your Image Search instance is in the Singapore region, your ECS instance or resource must also be in the Singapore region to access the Image Search service over a VPC. Otherwise, the call fails. If the call fails, check whether your ECS instance or resource is in the same region as the Image Search instance.
                // config.EndpointType = "internal";  // If you access the Image Search service over a private network, you must set the endpointType parameter. Set the value to "internal".
                // config.Endpoint = "imagesearch-vpc.ap-southeast-1.aliyuncs.com"; // This is a private endpoint. Replace it with the endpoint of the region where your instance is located. For example, if your instance is in the Singapore region, set the endpoint to "imagesearch-vpc.ap-southeast-1.aliyuncs.com".
                
                Client client = new Client(config);
                FileStream fs = File.OpenRead("D:/123.jpg");
                SearchImageByPicAdvanceRequest request = new SearchImageByPicAdvanceRequest();
                // Optional. The product category.
                // 1. For product search: If you set a category, the specified category is used. If you do not set a category, the system predicts the category. The predicted category is returned in the response.
                // 2. For generic search: The system sets the category to 88888888, regardless of whether you specify a category.
                request.CategoryId = 5;
                // The image content. The image can be up to 4 MB in size. The transfer timeout period is 5s. The following image formats are supported: PNG, JPG, JPEG, BMP, GIF, WEBP, TIFF, and PPM.
                // For product and generic image search, the image must be at least 100 pixels in height and width, and at most 4096 pixels in height and width.                
                // The image cannot contain rotation information.
                request.PicContentObject = fs;
                // Optional. Specifies whether to enable subject identification. The default value is true.
                // 1. If you set this parameter to true, the system performs subject identification and searches for the identified subject. The subject identification result is returned in the response.
                // 2. If you set this parameter to false, the system does not perform subject identification and searches for the entire image.
                request.Crop = true;
                // Optional. The filter condition.
                // The following operators are supported for int_attr: in, not in, >, >=, <, <=, and =. The following operators are supported for str_attr: in, not in, =, and !=. You can use AND and OR to connect multiple conditions.
                // Examples:
                //  1. Filter results by IntAttr: int_attr>=100
                //  2. Filter results by StrAttr: str_attr!="value1"
                //  3. Filter results by IntAttr and StrAttr: int_attr=1000 AND str_attr="value1"
                request.Filter= "int_attr=56 AND str_attr=\"test\" AND int_attr2 in (56)";
                // Optional. The similarity score threshold.
                // After you specify a similarity score threshold, only images with similarity scores greater than or equal to the threshold are returned. The threshold ranges from 0.00 to 1.00. The value can be accurate to two decimal places. The default value is 0.00.
                request.ScoreThreshold= "0.54";
                // Optional. The subject region of the image. The format is x1,x2,y1,y2. (x1, y1) are the coordinates of the upper-left corner, and (x2, y2) are the coordinates of the lower-right corner.
                //  The specified region cannot exceed the image boundaries.
                // If you specify the Region parameter, the system searches for the specified region, regardless of the value of the Crop parameter.
                request.Region = "66,333,98,356";
                // Required. The name of the Image Search instance. Note that this is the instance name, not the instance ID. After you purchase an instance, you can view the instance name in the instance information on the overview page of the Image Search console: https://imagesearch.console.alibabacloud.com/overview
                request.InstanceName = "XXXXXX";
                // Optional. If you set this parameter to true, the response data is returned based on ProductId.
                request.DistinctProductId = false;
                RuntimeOptions runtimeObject = new RuntimeOptions();
                try
                {
                    SearchImageByPicResponse response = client.SearchImageByPicAdvance(request, runtimeObject);
                    String result = Newtonsoft.Json.JsonConvert.SerializeObject(response);
                    Console.WriteLine("result:" + result);
                    }
                catch (TeaUnretryableException e)
                {
                    Console.WriteLine("InnerException result:" + e.InnerException.Message);
                    Console.WriteLine("Data result:" + e.Data);
                    Console.WriteLine("Message result:" + e.Message);
                    Console.WriteLine("Print String:" + e.ToString());
                }
            }
        }
    }
  • Sample result

    result:
    {
        "RequestId":"632814A0-F34D-46FB-882D-81D74E7C3290",
        "Success":true,
        "Code":0,
        "Msg":"success",
        "Auctions":[
            {
                "CategoryId":0,
                "ProductId":"test",
                "PicName":"test.jpg",
                "CustomContent":null,
                "Score":1.0
                "SortExprValues":"7.33136443711219;0",
                "IntAttr":null,
                "StrAttr":null
            },
            {......}
            ],
        "Head":{
            "DocsReturn":4,
            "DocsFound":4,
            "SearchTime":155
        },
        "PicInfo":{
            "CategoryId":0,
            "Region":"202,596,155,637",
            "AllCategories":[{"Id":0,"Name":"Tops"},{.....}],
            "MultiRegion":[
                {"Region":"112,440,76,387"}
            ]
         }
    }

SearchImageByName API

  • Code sample

    using AlibabaCloud.OpenApiClient.Models;
    using AlibabaCloud.SDK.ImageSearch20201214.Models;
    using AlibabaCloud.SDK.ImageSearch20201214;
    using AlibabaCloud.TeaUtil.Models;
    using System;
    using System.IO;
    namespace Test
    {
        class SearchImageByName
        {
            static void Main(string[] args)
            {
                Config config = new Config();
                // For more information about how to create an AccessKey pair, see https://www.alibabacloud.com/help/en/ram/user-guide/create-an-accesskey-pair
                // An AccessKey pair of an Alibaba Cloud account has all permissions on the API. We recommend that you use a RAM user to call the API or perform routine O&M.
                // We strongly recommend that you do not save the AccessKey ID and AccessKey secret in your project code. Otherwise, the AccessKey pair may be leaked and threaten the security of all resources in your account.
                // This example shows how to save the AccessKey ID and AccessKey secret in environment variables. You can also save the AccessKey pair in a configuration file as needed.
                IDictionary environmentVariables = Environment.GetEnvironmentVariables();
                foreach (DictionaryEntry de in environmentVariables)
                {
                    if (de.Key.Equals("CC_AK_ENV")) {
                        config.AccessKeyId = (string)de.Value;
                    }
                    if (de.Key.Equals("CC_SK_ENV"))
                    {
                        config.AccessKeySecret = (string)de.Value;
                    }
                }            
                config.Endpoint = "imagesearch.ap-southeast-1.aliyuncs.com";
                config.RegionId = "ap-southeast-1";
                config.Type = "access_key"; 
    
                // The following code shows how to access the service over a VPC.
                // Note: You can access the service over a VPC only from an ECS instance or a resource that is in the same region as the Image Search instance. For example, if your Image Search instance is in the Singapore region, your ECS instance or resource must also be in the Singapore region to access the Image Search service over a VPC. Otherwise, the call fails. If the call fails, check whether your ECS instance or resource is in the same region as the Image Search instance.
                // config.EndpointType = "internal";  // If you access the Image Search service over a private network, you must set the endpointType parameter. Set the value to "internal".
                // config.Endpoint = "imagesearch-vpc.ap-southeast-1.aliyuncs.com"; // This is a private endpoint. Replace it with the endpoint of the region where your instance is located. For example, if your instance is in the Singapore region, set the endpoint to "imagesearch-vpc.ap-southeast-1.aliyuncs.com".
                
    
                Client client = new Client(config);            
                SearchImageByNameRequest request = new SearchImageByNameRequest();
                // Optional. The product category.
                // 1. For product search: If you set a category, the specified category is used. If you do not set a category, the system predicts the category. The predicted category is returned in the response.
                // 2. For generic search: The system sets the category to 88888888, regardless of whether you specify a category.
                request.CategoryId = 5;
                // Required. The name of the Image Search instance. Note that this is the instance name, not the instance ID. After you purchase an instance, you can view the instance name in the instance information on the overview page of the Image Search console: https://imagesearch.console.alibabacloud.com/overview
                request.InstanceName = "XXXXXXXXXX";
                // Required. The name of the image. The name can be up to 256 characters in length.
                // 1. An image is uniquely identified by the combination of ProductId and PicName.
                request.PicName = "xusong.jpg";
                // Required. The product ID. The ID can be up to 256 characters in length.
                // A product can have multiple images.
                request.ProductId = "1001";
                // Optional. The filter condition.
                // The following operators are supported for int_attr: in, not in, >, >=, <, <=, and =. The following operators are supported for str_attr: in, not in, =, and !=. You can use AND and OR to connect multiple conditions.
                // Examples:
                //  1. Filter results by IntAttr: int_attr>=100
                //  2. Filter results by StrAttr: str_attr!="value1"
                //  3. Filter results by IntAttr and StrAttr: int_attr=1000 AND str_attr="value1"
                request.Filter= "int_attr=56 AND str_attr=\"test\" AND int_attr2 in (56)";
                // Optional. The similarity score threshold.
                // After you specify a similarity score threshold, only images with similarity scores greater than or equal to the threshold are returned. The threshold ranges from 0.00 to 1.00. The value can be accurate to two decimal places. The default value is 0.00.
                request.ScoreThreshold= "0.54";
                try
                {
                    SearchImageByNameResponse response = client.SearchImageByName(request);
                    String result = Newtonsoft.Json.JsonConvert.SerializeObject(response);
                    Console.WriteLine("result:" + result);
                }
                catch (TeaUnretryableException e)
                {
                    Console.WriteLine("InnerException result:" + e.InnerException.Message);
                    Console.WriteLine("Data result:" + e.Data);
                    Console.WriteLine("Message result:" + e.Message);
                    Console.WriteLine("Print String:" + e.ToString());
                }
            }
        }
    }
  • Sample result

    result:
    {
        "RequestId":"5B16E5CD-FE8A-4A4E-A90B-02A5C9F8BD81",
        "Success":true,
        "Code":0,
        "Msg":"success",
        "Auctions":[
            {
                "CategoryId":0,
                "ProductId":"test",
                "PicName":"test.jpg",
                "CustomContent":null,
                "Score":1.0
                "SortExprValues":"7.33136443711219;0",
                "IntAttr":null,
                "StrAttr":null
            },
            {....}
        ],
        "Head":{
            "DocsReturn":4,
            "DocsFound":4,
            "SearchTime":50
        },
        "PicInfo":{
            "CategoryId":0,
            "Region":null,
            "AllCategories":[
                {"Id":0,"Name":"Tops"},
                {...}
            ],
           "MultiRegion":[
                {"Region":"112,440,76,387"}
           ]
        }
    }

Delete API

  • Code sample

    using AlibabaCloud.OpenApiClient.Models;
    using AlibabaCloud.SDK.ImageSearch20201214.Models;
    using AlibabaCloud.SDK.ImageSearch20201214;
    using AlibabaCloud.TeaUtil.Models;
    using System;
    using System.IO;
    namespace Test
    {
        class Delete
        {
            static void Main(string[] args)
            {
                Config config = new Config();
                // For more information about how to create an AccessKey pair, see https://www.alibabacloud.com/help/en/ram/user-guide/create-an-accesskey-pair
                // An AccessKey pair of an Alibaba Cloud account has all permissions on the API. We recommend that you use a RAM user to call the API or perform routine O&M.
                // We strongly recommend that you do not save the AccessKey ID and AccessKey secret in your project code. Otherwise, the AccessKey pair may be leaked and threaten the security of all resources in your account.
                // This example shows how to save the AccessKey ID and AccessKey secret in environment variables. You can also save the AccessKey pair in a configuration file as needed.
                IDictionary environmentVariables = Environment.GetEnvironmentVariables();
                foreach (DictionaryEntry de in environmentVariables)
                {
                    if (de.Key.Equals("CC_AK_ENV")) {
                        config.AccessKeyId = (string)de.Value;
                    }
                    if (de.Key.Equals("CC_SK_ENV"))
                    {
                        config.AccessKeySecret = (string)de.Value;
                    }
                }            
                config.Endpoint = "imagesearch.ap-southeast-1.aliyuncs.com";
                config.RegionId = "ap-southeast-1";
                config.Type = "access_key"; 
    
                // The following code shows how to access the service over a VPC.
                // Note: You can access the service over a VPC only from an ECS instance or a resource that is in the same region as the Image Search instance. For example, if your Image Search instance is in the Singapore region, your ECS instance or resource must also be in the Singapore region to access the Image Search service over a VPC. Otherwise, the call fails. If the call fails, check whether your ECS instance or resource is in the same region as the Image Search instance.
                // config.EndpointType = "internal";  // If you access the Image Search service over a private network, you must set the endpointType parameter. Set the value to "internal".
                // config.Endpoint = "imagesearch-vpc.ap-southeast-1.aliyuncs.com"; // This is a private endpoint. Replace it with the endpoint of the region where your instance is located. For example, if your instance is in the Singapore region, set the endpoint to "imagesearch-vpc.ap-southeast-1.aliyuncs.com".
                
    
                Client client = new Client(config);
                DeleteImageRequest request = new DeleteImageRequest();
                // Required. The name of the Image Search instance. Note that this is the instance name, not the instance ID. After you purchase an instance, you can view the instance name in the instance information on the overview page of the Image Search console: https://imagesearch.console.alibabacloud.com/overview
                request.InstanceName = "XXXXXXXXXXX";
                // Required. The name of the image. The name can be up to 256 characters in length.
                // 1. An image is uniquely identified by the combination of ProductId and PicName.
                request.PicName = "xusong.jpg";
                //  Optional. The name of the image. If you do not specify this parameter, all images under the specified ProductId are deleted. If you specify this parameter, the image specified by the combination of ProductId and PicName is deleted.
                request.ProductId = "1001";
                // Optional. If you set this parameter to true, images are deleted based on the filter condition.
                request.IsDeleteByFilter = false;
                request.Filter = "intattr3=xxx";
                try
                {
                    DeleteImageResponse response = client.DeleteImage(request);
                    Console.WriteLine("RequestId:" + response.Body.RequestId);
                    Console.WriteLine("Message:" + response.Body.Message);
                    Console.WriteLine("Code:" + response.Body.Code);
                }
                catch (TeaUnretryableException e)
                {
                    Console.WriteLine("InnerException result:" + e.InnerException.Message);
                    Console.WriteLine("Data result:" + e.Data);
                    Console.WriteLine("Message result:" + e.Message);
                    Console.WriteLine("Print String:" + e.ToString());
                }
            }
        }
    }
  • Sample result

    RequestId:D9BDEAE0-674C-4126-9D76-A79F0BE9E881
    Message:success
    Code:0

UpdateImage API

  • Code sample

    using AlibabaCloud.OpenApiClient.Models;
    using AlibabaCloud.SDK.ImageSearch20201214.Models;
    using AlibabaCloud.SDK.ImageSearch20201214;
    using AlibabaCloud.TeaUtil.Models;
    using System;
    using System.IO;
    namespace Test
    {
        class UpdateImage
        {
            static void Main(string[] args)
            {
                Config config = new Config();
                // For more information about how to create an AccessKey pair, see https://www.alibabacloud.com/help/en/ram/user-guide/create-an-accesskey-pair
                // An AccessKey pair of an Alibaba Cloud account has all permissions on the API. We recommend that you use a RAM user to call the API or perform routine O&M.
                // We strongly recommend that you do not save the AccessKey ID and AccessKey secret in your project code. Otherwise, the AccessKey pair may be leaked and threaten the security of all resources in your account.
                // This example shows how to save the AccessKey ID and AccessKey secret in environment variables. You can also save the AccessKey pair in a configuration file as needed.
                IDictionary environmentVariables = Environment.GetEnvironmentVariables();
                foreach (DictionaryEntry de in environmentVariables)
                {
                    if (de.Key.Equals("CC_AK_ENV")) {
                        config.AccessKeyId = (string)de.Value;
                    }
                    if (de.Key.Equals("CC_SK_ENV"))
                    {
                        config.AccessKeySecret = (string)de.Value;
                    }
                }            
                
                config.Endpoint = "imagesearch.ap-southeast-1.aliyuncs.com";
                config.RegionId = "ap-southeast-1";
                config.Type = "access_key"; 
    
                // The following code shows how to access the service over a VPC.
                // Note: You can access the service over a VPC only from an ECS instance or a resource that is in the same region as the Image Search instance. For example, if your Image Search instance is in the Singapore region, your ECS instance or resource must also be in the Singapore region to access the Image Search service over a VPC. Otherwise, the call fails. If the call fails, check whether your ECS instance or resource is in the same region as the Image Search instance.
                // config.EndpointType = "internal";  // If you access the Image Search service over a private network, you must set the endpointType parameter. Set the value to "internal".
                // config.Endpoint = "imagesearch-vpc.ap-southeast-1.aliyuncs.com"; // This is a private endpoint. Replace it with the endpoint of the region where your instance is located. For example, if your instance is in the Singapore region, set the endpoint to "imagesearch-vpc.ap-southeast-1.aliyuncs.com".
                
    
                Client client = new Client(config);
                UpdateImageRequest request = new UpdateImageRequest();
                // Required. The name of the Image Search instance. Note that this is the instance name, not the instance ID. After you purchase an instance, you can view the instance name in the instance information on the overview page of the Image Search console: https://imagesearch.console.alibabacloud.com/overview
                request.InstanceName = "XXXXXXXXXXX";
                // Required. The product ID. This parameter cannot be modified.
                request.ProductId = "1";
                // Required. The name of the image. This parameter cannot be modified.
                request.PicName = "1";
                // Optional. The integer attribute. You can use this attribute to filter images during a search. This field is returned in the query results.
                request.IntAttr = 1;
                // Optional. The string attribute. The attribute can be up to 128 characters in length. You can use this attribute to filter images during a search. This field is returned in the query results.
                request.StrAttr = "test";
                // Optional. The custom content. The content can be up to 4096 characters in length.
                request.CustomContent ="This is a test description.";
                try
                {
                    UpdateImageResponse response = client.UpdateImage(request);
                    String result = Newtonsoft.Json.JsonConvert.SerializeObject(response.Body);
                    Console.WriteLine("result:" + result);
                }
                catch (TeaUnretryableException e)
                {
                    Console.WriteLine("InnerException result:" + e.InnerException.Message);
                    Console.WriteLine("Data result:" + e.Data);
                    Console.WriteLine("Message result:" + e.Message);
                    Console.WriteLine("Print String:" + e.ToString());
                }
            }
        }
    }
  • Sample result

    result:{"Code":0,"Message":null,"RequestId":"4F66A9C0-9D36-152A-B5DB-C0B3624D3331","Success":true}

Detail API

  • Code sample

    using AlibabaCloud.OpenApiClient.Models;
    using AlibabaCloud.SDK.ImageSearch20201214.Models;
    using AlibabaCloud.SDK.ImageSearch20201214;
    using AlibabaCloud.TeaUtil.Models;
    using System;
    using System.IO;
    namespace Test
    {
        class Detail
        {
            static void Main(string[] args)
            {
                Config config = new Config();
                // For more information about how to create an AccessKey pair, see https://www.alibabacloud.com/help/en/ram/user-guide/create-an-accesskey-pair
                // An AccessKey pair of an Alibaba Cloud account has all permissions on the API. We recommend that you use a RAM user to call the API or perform routine O&M.
                // We strongly recommend that you do not save the AccessKey ID and AccessKey secret in your project code. Otherwise, the AccessKey pair may be leaked and threaten the security of all resources in your account.
                // This example shows how to save the AccessKey ID and AccessKey secret in environment variables. You can also save the AccessKey pair in a configuration file as needed.
                IDictionary environmentVariables = Environment.GetEnvironmentVariables();
                foreach (DictionaryEntry de in environmentVariables)
                {
                    if (de.Key.Equals("CC_AK_ENV")) {
                        config.AccessKeyId = (string)de.Value;
                    }
                    if (de.Key.Equals("CC_SK_ENV"))
                    {
                        config.AccessKeySecret = (string)de.Value;
                    }
                }            
                config.Endpoint = "imagesearch.ap-southeast-1.aliyuncs.com";
                config.RegionId = "ap-southeast-1";
                config.Type = "access_key"; 
    
                // The following code shows how to access the service over a VPC.
                // Note: You can access the service over a VPC only from an ECS instance or a resource that is in the same region as the Image Search instance. For example, if your Image Search instance is in the Singapore region, your ECS instance or resource must also be in the Singapore region to access the Image Search service over a VPC. Otherwise, the call fails. If the call fails, check whether your ECS instance or resource is in the same region as the Image Search instance.
                // config.EndpointType = "internal";  // If you access the Image Search service over a private network, you must set the endpointType parameter. Set the value to "internal".
                // config.Endpoint = "imagesearch-vpc.ap-southeast-1.aliyuncs.com"; // This is a private endpoint. Replace it with the endpoint of the region where your instance is located. For example, if your instance is in the Singapore region, set the endpoint to "imagesearch-vpc.ap-southeast-1.aliyuncs.com".
                
    
                Client client = new Client(config);
                DetailRequest request = new DetailRequest();
                // Required. The name of the Image Search instance. Note that this is the instance name, not the instance ID. After you purchase an instance, you can view the instance name in the instance information on the overview page of the Image Search console: https://imagesearch.console.alibabacloud.com/overview
                request.InstanceName = "XXXXXXXXXXX";
                try
                {
                    DetailResponse response = client.Detail(request);
                    String result = Newtonsoft.Json.JsonConvert.SerializeObject(response.Body);
                    Console.WriteLine("result:" + result);
                }
                catch (TeaUnretryableException e)
                {
                    Console.WriteLine("InnerException result:" + e.InnerException.Message);
                    Console.WriteLine("Data result:" + e.Data);
                    Console.WriteLine("Message result:" + e.Message);
                    Console.WriteLine("Print String:" + e.ToString());
                }
            }
        }
    }
  • Sample result

    {
      RequestId=046913C5-942A-1DD2-959F-7CECD790ADB2,
      Instance={
        UtcExpireTime=1649692800000,
        TotalCount=225320,
        UtcCreate=1633936585000,
        Capacity=250,
        Qps=5,
        ServiceType=0,
        Region=cn-shanghai,
        Name=xxxx
      },
      Success=true
    }

DumpMeta API

  • Code sample

    using AlibabaCloud.OpenApiClient.Models;
    using AlibabaCloud.SDK.ImageSearch20201214.Models;
    using AlibabaCloud.SDK.ImageSearch20201214;
    using AlibabaCloud.TeaUtil.Models;
    using System;
    using System.IO;
    namespace Test
    {
        class DumpMeta
        {
            static void Main(string[] args)
            {
                Config config = new Config();
                // For more information about how to create an AccessKey pair, see https://www.alibabacloud.com/help/en/ram/user-guide/create-an-accesskey-pair
                // An AccessKey pair of an Alibaba Cloud account has all permissions on the API. We recommend that you use a RAM user to call the API or perform routine O&M.
                // We strongly recommend that you do not save the AccessKey ID and AccessKey secret in your project code. Otherwise, the AccessKey pair may be leaked and threaten the security of all resources in your account.
                // This example shows how to save the AccessKey ID and AccessKey secret in environment variables. You can also save the AccessKey pair in a configuration file as needed.
                IDictionary environmentVariables = Environment.GetEnvironmentVariables();
                foreach (DictionaryEntry de in environmentVariables)
                {
                    if (de.Key.Equals("CC_AK_ENV")) {
                        config.AccessKeyId = (string)de.Value;
                    }
                    if (de.Key.Equals("CC_SK_ENV"))
                    {
                        config.AccessKeySecret = (string)de.Value;
                    }
                }            
                config.Endpoint = "imagesearch.ap-southeast-1.aliyuncs.com";
                config.RegionId = "ap-southeast-1";
                config.Type = "access_key"; 
    
                // The following code shows how to access the service over a VPC.
                // Note: You can access the service over a VPC only from an ECS instance or a resource that is in the same region as the Image Search instance. For example, if your Image Search instance is in the Singapore region, your ECS instance or resource must also be in the Singapore region to access the Image Search service over a VPC. Otherwise, the call fails. If the call fails, check whether your ECS instance or resource is in the same region as the Image Search instance.
                // config.EndpointType = "internal";  // If you access the Image Search service over a private network, you must set the endpointType parameter. Set the value to "internal".
                // config.Endpoint = "imagesearch-vpc.ap-southeast-1.aliyuncs.com"; // This is a private endpoint. Replace it with the endpoint of the region where your instance is located. For example, if your instance is in the Singapore region, set the endpoint to "imagesearch-vpc.ap-southeast-1.aliyuncs.com".
                
    
                Client client = new Client(config);
                DumpMetaRequest request = new DumpMetaRequest();
                // Required. The name of the Image Search instance. Note that this is the instance name, not the instance ID. After you purchase an instance, you can view the instance name in the instance information on the overview page of the Image Search console: https://imagesearch.console.alibabacloud.com/overview
                request.InstanceName = "XXXXXXXXXXX";
                try
                {
                    DumpMetaResponse response = client.DumpMeta(request);
                    String result = Newtonsoft.Json.JsonConvert.SerializeObject(response.Body);
                    Console.WriteLine("result:" + result);
                }
                catch (TeaUnretryableException e)
                {
                    Console.WriteLine("InnerException result:" + e.InnerException.Message);
                    Console.WriteLine("Data result:" + e.Data);
                    Console.WriteLine("Message result:" + e.Message);
                    Console.WriteLine("Print String:" + e.ToString());
                }
            }
        }
    }
  • Sample result

    {
      RequestId=FC4191AA-1D5B-1001-9A70-18FBB2BD265B,
      Data={
        DumpMetaStatus=PROCESSING,
        Id=567
      },
      Success=true
    }

DumpMetaList API

  • Code sample

    using AlibabaCloud.OpenApiClient.Models;
    using AlibabaCloud.SDK.ImageSearch20201214.Models;
    using AlibabaCloud.SDK.ImageSearch20201214;
    using AlibabaCloud.TeaUtil.Models;
    using System;
    using System.IO;
    namespace Test
    {
        class DumpMetaList
        {
            static void Main(string[] args)
            {
                Config config = new Config();
                // For more information about how to create an AccessKey pair, see https://www.alibabacloud.com/help/en/ram/user-guide/create-an-accesskey-pair
                // An AccessKey pair of an Alibaba Cloud account has all permissions on the API. We recommend that you use a RAM user to call the API or perform routine O&M.
                // We strongly recommend that you do not save the AccessKey ID and AccessKey secret in your project code. Otherwise, the AccessKey pair may be leaked and threaten the security of all resources in your account.
                // This example shows how to save the AccessKey ID and AccessKey secret in environment variables. You can also save the AccessKey pair in a configuration file as needed.
                IDictionary environmentVariables = Environment.GetEnvironmentVariables();
                foreach (DictionaryEntry de in environmentVariables)
                {
                    if (de.Key.Equals("CC_AK_ENV")) {
                        config.AccessKeyId = (string)de.Value;
                    }
                    if (de.Key.Equals("CC_SK_ENV"))
                    {
                        config.AccessKeySecret = (string)de.Value;
                    }
                }            
                config.Endpoint = "imagesearch.ap-southeast-1.aliyuncs.com";
                config.RegionId = "ap-southeast-1";
                config.Type = "access_key"; 
    
                // The following code shows how to access the service over a VPC.
                // Note: You can access the service over a VPC only from an ECS instance or a resource that is in the same region as the Image Search instance. For example, if your Image Search instance is in the Singapore region, your ECS instance or resource must also be in the Singapore region to access the Image Search service over a VPC. Otherwise, the call fails. If the call fails, check whether your ECS instance or resource is in the same region as the Image Search instance.
                // config.EndpointType = "internal";  // If you access the Image Search service over a private network, you must set the endpointType parameter. Set the value to "internal".
                // config.Endpoint = "imagesearch-vpc.ap-southeast-1.aliyuncs.com"; // This is a private endpoint. Replace it with the endpoint of the region where your instance is located. For example, if your instance is in the Singapore region, set the endpoint to "imagesearch-vpc.ap-southeast-1.aliyuncs.com".
                
    
                Client client = new Client(config);
                DumpMetaListRequest request = new DumpMetaListRequest();
                // Required. The name of the Image Search instance. Note that this is the instance name, not the instance ID. After you purchase an instance, you can view the instance name in the instance information on the overview page of the Image Search console: https://imagesearch.console.alibabacloud.com/overview
                request.InstanceName = "XXXXXXXXXXX";
                // Optional. The ID of the metadata export task.
                request.Id = 567;
                // Optional. The start position of the results to return. Default value: 1.
                request.PageNumber = 1;
                // Optional. The number of results to return. Default value: 20.
                request.PageSize = 1;
                try
                {
                    DumpMetaListResponse response = client.DumpMetaList(request);
                    String result = Newtonsoft.Json.JsonConvert.SerializeObject(response.Body);
                    Console.WriteLine("result:" + result);
                }
                catch (TeaUnretryableException e)
                {
                    Console.WriteLine("InnerException result:" + e.InnerException.Message);
                    Console.WriteLine("Data result:" + e.Data);
                    Console.WriteLine("Message result:" + e.Message);
                    Console.WriteLine("Print String:" + e.ToString());
                }
            }
        }
    }
  • Sample result

    {
      RequestId=850DFBD9-A179-12FB-B193-2D08ACEA586B,
      Data={
        TotalCount=1,
        PageSize=1,
        PageNumber=1,
        DumpMetaList=[
          {
            Status=SUCCESS,
            Msg=success,
            MetaUrl=https: //****.com/x?Expires=x,
            UtcCreate=1639969113000,
            UtcModified=1639969140000,
            Id=567,
            Code=0
          }
        ]
      }
    }

BatchTask API

  • Code sample

    using AlibabaCloud.OpenApiClient.Models;
    using AlibabaCloud.SDK.ImageSearch20201214.Models;
    using AlibabaCloud.SDK.ImageSearch20201214;
    using AlibabaCloud.TeaUtil.Models;
    using System;
    using System.IO;
    namespace Test
    {
        class BatchTask
        {
            static void Main(string[] args)
            {
                Config config = new Config();
                // For more information about how to create an AccessKey pair, see https://www.alibabacloud.com/help/en/ram/user-guide/create-an-accesskey-pair
                // An AccessKey pair of an Alibaba Cloud account has all permissions on the API. We recommend that you use a RAM user to call the API or perform routine O&M.
                // We strongly recommend that you do not save the AccessKey ID and AccessKey secret in your project code. Otherwise, the AccessKey pair may be leaked and threaten the security of all resources in your account.
                // This example shows how to save the AccessKey ID and AccessKey secret in environment variables. You can also save the AccessKey pair in a configuration file as needed.
                IDictionary environmentVariables = Environment.GetEnvironmentVariables();
                foreach (DictionaryEntry de in environmentVariables)
                {
                    if (de.Key.Equals("CC_AK_ENV")) {
                        config.AccessKeyId = (string)de.Value;
                    }
                    if (de.Key.Equals("CC_SK_ENV"))
                    {
                        config.AccessKeySecret = (string)de.Value;
                    }
                }            
                config.Endpoint = "imagesearch.ap-southeast-1.aliyuncs.com";
                config.RegionId = "ap-southeast-1";
                config.Type = "access_key"; 
    
                // The following code shows how to access the service over a VPC.
                // Note: You can access the service over a VPC only from an ECS instance or a resource that is in the same region as the Image Search instance. For example, if your Image Search instance is in the Singapore region, your ECS instance or resource must also be in the Singapore region to access the Image Search service over a VPC. Otherwise, the call fails. If the call fails, check whether your ECS instance or resource is in the same region as the Image Search instance.
                // config.EndpointType = "internal";  // If you access the Image Search service over a private network, you must set the endpointType parameter. Set the value to "internal".
                // config.Endpoint = "imagesearch-vpc.ap-southeast-1.aliyuncs.com"; // This is a private endpoint. Replace it with the endpoint of the region where your instance is located. For example, if your instance is in the Singapore region, set the endpoint to "imagesearch-vpc.ap-southeast-1.aliyuncs.com".
                
    
                Client client = new Client(config);
                IncreaseInstanceRequest request = new IncreaseInstanceRequest();
                // Required. The name of the Image Search instance. Note that this is the instance name, not the instance ID. After you purchase an instance, you can view the instance name in the instance information on the overview page of the Image Search console: https://imagesearch.console.alibabacloud.com/overview
                request.InstanceName = "XXXXXXXXXXX";
                // Required. The name of the OSS bucket.
                request.BucketName = "bucketName";
                // Required. The path. The path must start with a forward slash (/) and cannot end with a forward slash (/).
                // You must prepare an increment.meta file in this path in advance. For more information, see the Batch operations documentation in the User Guide.
                request.Path = "/public/xx";
                // Optional. The webhook address for successful requests. The address must start with http:// or https://.
                request.CallbackAddress = "xxx";
                try
                {
                    IncreaseInstanceResponse response = client.IncreaseInstance(request);
                    String result = Newtonsoft.Json.JsonConvert.SerializeObject(response.Body);
                    Console.WriteLine("result:" + result);
                }
                catch (TeaUnretryableException e)
                {
                    Console.WriteLine("InnerException result:" + e.InnerException.Message);
                    Console.WriteLine("Data result:" + e.Data);
                    Console.WriteLine("Message result:" + e.Message);
                    Console.WriteLine("Print String:" + e.ToString());
                }
            }
        }
    }
  • Sample result

    {
      RequestId=F9BAD635-3031-1EBB-BE9E-E9FCB318A28C,
      Data={
        IncrementStatus=PROCESSING,
        Id=1470
      },
      Success=true
    }

BatchTaskList API

  • Code sample

    using AlibabaCloud.OpenApiClient.Models;
    using AlibabaCloud.SDK.ImageSearch20201214.Models;
    using AlibabaCloud.SDK.ImageSearch20201214;
    using AlibabaCloud.TeaUtil.Models;
    using System;
    using System.IO;
    namespace Test
    {
        class BatchTaskList
        {
            static void Main(string[] args)
            {
                Config config = new Config();
                // For more information about how to create an AccessKey pair, see https://www.alibabacloud.com/help/en/ram/user-guide/create-an-accesskey-pair
                // An AccessKey pair of an Alibaba Cloud account has all permissions on the API. We recommend that you use a RAM user to call the API or perform routine O&M.
                // We strongly recommend that you do not save the AccessKey ID and AccessKey secret in your project code. Otherwise, the AccessKey pair may be leaked and threaten the security of all resources in your account.
                // This example shows how to save the AccessKey ID and AccessKey secret in environment variables. You can also save the AccessKey pair in a configuration file as needed.
                IDictionary environmentVariables = Environment.GetEnvironmentVariables();
                foreach (DictionaryEntry de in environmentVariables)
                {
                    if (de.Key.Equals("CC_AK_ENV")) {
                        config.AccessKeyId = (string)de.Value;
                    }
                    if (de.Key.Equals("CC_SK_ENV"))
                    {
                        config.AccessKeySecret = (string)de.Value;
                    }
                }            
                config.Endpoint = "imagesearch.ap-southeast-1.aliyuncs.com";
                config.RegionId = "ap-southeast-1";
                config.Type = "access_key"; 
    
                // The following code shows how to access the service over a VPC.
                // Note: You can access the service over a VPC only from an ECS instance or a resource that is in the same region as the Image Search instance. For example, if your Image Search instance is in the Singapore region, your ECS instance or resource must also be in the Singapore region to access the Image Search service over a VPC. Otherwise, the call fails. If the call fails, check whether your ECS instance or resource is in the same region as the Image Search instance.
                // config.EndpointType = "internal";  // If you access the Image Search service over a private network, you must set the endpointType parameter. Set the value to "internal".
                // config.Endpoint = "imagesearch-vpc.ap-southeast-1.aliyuncs.com"; // This is a private endpoint. Replace it with the endpoint of the region where your instance is located. For example, if your instance is in the Singapore region, set the endpoint to "imagesearch-vpc.ap-southeast-1.aliyuncs.com".
                
    
                Client client = new Client(config);
                IncreaseListRequest request = new IncreaseListRequest();
                // Required. The name of the Image Search instance. Note that this is the instance name, not the instance ID. After you purchase an instance, you can view the instance name in the instance information on the overview page of the Image Search console: https://imagesearch.console.alibabacloud.com/overview
                request.InstanceName = "XXXXXXXXXXX";
                // Optional. The ID of the metadata export task.
                request.Id = 567;
                // Required. The name of the OSS bucket.
                request.BucketName = "bucketName";
                // Required. The path. The path must start with a forward slash (/) and cannot end with a forward slash (/).
                request.Path = "/public/xx";
                // Optional. The start position of the results to return. Default value: 1.
                request.PageNumber = 1;
                // Optional. The number of results to return. Default value: 20.
                request.PageSize = 1;
                try
                {
                    IncreaseListResponse response = client.IncreaseList(request);
                    String result = Newtonsoft.Json.JsonConvert.SerializeObject(response.Body);
                    Console.WriteLine("result:" + result);
                }
                catch (TeaUnretryableException e)
                {
                    Console.WriteLine("InnerException result:" + e.InnerException.Message);
                    Console.WriteLine("Data result:" + e.Data);
                    Console.WriteLine("Message result:" + e.Message);
                    Console.WriteLine("Print String:" + e.ToString());
                }
            }
        }
    }
  • Sample result

    {
      RequestId=56E7E6CC-64AB-17CA-A7CD-1948FB953B8C,
      Data={
        TotalCount=1,
        PageSize=1,
        PageNumber=1,
        Increments={
          Instance=[
            {
              Msg=success,
              Status=NORMAL,
              Path=/xx/xx,
              BucketName=bucketName,
              UtcCreate=1639107872000,
              ErrorUrl=https: //example.com/xxx?Expires=1670661540&xxx=xx,
              UtcModified=1639125540000,
              Id=1464,
              CallbackAddress=null,
              Code=0
            }
          ]
        }
      }
    }

CompareSimilarByImage API

  • Code sample

    using AlibabaCloud.OpenApiClient.Models;
    using AlibabaCloud.SDK.ImageSearch20201214.Models;
    using AlibabaCloud.SDK.ImageSearch20201214;
    using AlibabaCloud.TeaUtil.Models;
    using System;
    using System.IO;
    namespace Test
    {
        class CompareSimilarByImage
        {
            static void Main(string[] args)
            {
                // Console.WriteLine("Hello World!");
                Config config = new Config();
                // For more information about how to create an AccessKey pair, see https://www.alibabacloud.com/help/en/ram/user-guide/create-an-accesskey-pair
                // An AccessKey pair of an Alibaba Cloud account has all permissions on the API. We recommend that you use a RAM user to call the API or perform routine O&M.
                // We strongly recommend that you do not save the AccessKey ID and AccessKey secret in your project code. Otherwise, the AccessKey pair may be leaked and threaten the security of all resources in your account.
                // This example shows how to save the AccessKey ID and AccessKey secret in environment variables. You can also save the AccessKey pair in a configuration file as needed.
                IDictionary environmentVariables = Environment.GetEnvironmentVariables();
                foreach (DictionaryEntry de in environmentVariables)
                {
                    if (de.Key.Equals("CC_AK_ENV")) {
                        config.AccessKeyId = (string)de.Value;
                    }
                    if (de.Key.Equals("CC_SK_ENV"))
                    {
                        config.AccessKeySecret = (string)de.Value;
                    }
                }
                config.Endpoint = "imagesearch.ap-southeast-1.aliyuncs.com";
                config.RegionId = "ap-southeast-1";
                config.Type = "access_key"; 
    
                // The following code shows how to access the service over a VPC.
                // Note: You can access the service over a VPC only from an ECS instance or a resource that is in the same region as the Image Search instance. For example, if your Image Search instance is in the Singapore region, your ECS instance or resource must also be in the Singapore region to access the Image Search service over a VPC. Otherwise, the call fails. If the call fails, check whether your ECS instance or resource is in the same region as the Image Search instance.
                // config.EndpointType = "internal";  // If you access the Image Search service over a private network, you must set the endpointType parameter. Set the value to "internal".
                // config.Endpoint = "imagesearch-vpc.ap-southeast-1.aliyuncs.com"; // This is a private endpoint. Replace it with the endpoint of the region where your instance is located. For example, if your instance is in the Singapore region, set the endpoint to "imagesearch-vpc.ap-southeast-1.aliyuncs.com".
                
                Client client = new Client(config);
                FileStream fs1 = File.OpenRead("D:/111.jpg");
                FileStream fs2 = File.OpenRead("D:/222.jpg");
                CompareSimilarByImageAdvanceRequest request = new CompareSimilarByImageAdvanceRequest();
               
                // Required. The name of the Image Search instance. Note that this is the instance name, not the instance ID. After you purchase an instance, you can view the instance name in the instance information on the overview page of the Image Search console: https://imagesearch.console.alibabacloud.com/overview
                request.InstanceName = "XXXXXXXXXXXXXXXXXXXXXXXXX";
                // The image content. The image can be up to 4 MB in size. The transfer timeout period is 5s. The following image formats are supported: PNG, JPG, JPEG, BMP, GIF, WEBP, TIFF, and PPM.
                // For product, trademark, and generic image search, the image must be at least 100 pixels in height and width, and at most 4096 pixels in height and width.
                // For fabric search, the image must be at least 100 pixels in height and width, and at most 4096 pixels in height and width.
                // The image cannot contain rotation information.
                request.PrimaryPicContentObject = fs1;
                request.SecondaryPicContentObject = fs2;
               
                RuntimeOptions runtimeObject = new RuntimeOptions();
                try
                {
                    CompareSimilarByImageResponse response = client.CompareSimilarByImageAdvance(request, runtimeObject);
                    Console.WriteLine("result:" + Newtonsoft.Json.JsonConvert.SerializeObject(response));
                }
                catch (TeaUnretryableException e)
                {
                    Console.WriteLine("InnerException result:" + e.InnerException.Message);
                    Console.WriteLine("Data result:" + e.Data);
                    Console.WriteLine("Message result:" + e.Message);
                    Console.WriteLine("Print String:" + e.ToString());
                }
            }
        }
    }
  • Sample result

    {
        "Headers": {
            "date": "Mon, 11 Jan 2021 06:57:16 GMT",
            "connection": "keep-alive",
            "access-control-allow-origin": "*",
            "access-control-allow-methods": "POST, GET, OPTIONS",
            "access-control-allow-headers": "X-Requested-With, X-Sequence, _aop_secret, _aop_signature",
            "access-control-max-age": "172800",
            "x-acs-request-id": "6D32C931-D584-4927-938A-6053AE9B630D"
        },
        "Body": {
            "Message": "success",
            "RequestId": "6D32C931-D584-4927-938A-6053AE9B630D",
            "Code": 0,
            "Score": 0.82,
            "Success": true
        }
    }