Update Images Features in Search Context Introduction
This article explains how to update images features in search context.
The API URL is: PUT /imaging/ai/imageSearch/{searchContextId}/features
Resource URI
Swagger UI lets you call Aspose.Imaging REST APIs directly from the browser. The description of the APIs and their parameters are also given there.
cURL Example
SDKs
Using an SDK (API client) is the quickest way for a developer to speed up the development. An SDK takes care of a lot of low-level details of making requests and handling responses and lets you focus on writing code specific to your particular project. Check out our GitHub repository for a complete list of Aspose.Imaging SDKs along with working examples, to get you started in no time.
SDK Examples
.NET
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-imaging-cloud/aspose-imaging-cloud-dotnet
protected void UpdateImageFeaturesInSearchContext(string imageName)
{
UpdateImageFeaturesRequest updateImageFeaturesRequest =
new UpdateImageFeaturesRequest(this.SearchContextId, imageId: imageName);
this.ImagingApi.UpdateImageFeatures(updateImageFeaturesRequest);
}
Java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String APP_KEY = ""; // Get AppKey and AppSID from https:dashboard.aspose.cloud/
String APP_SID = ""; // Get AppKey and AppSID from https:dashboard.aspose.cloud/
String DATA_PATH = "src/main/resources/";
ImagingApi imagingApi = new ImagingApi(APP_KEY, APP_SID);
String fileName = "WaterMark.bmp";
try {
// Upload local image to storage
File inputFile = new File(DATA_PATH + fileName);
FileInputStream localInputImageStream = new FileInputStream(inputFile);
byte[] localInputImage = IOUtils.toByteArray(localInputImageStream);
UploadFileRequest uploadFileRequest = new UploadFileRequest(fileName, localInputImage, null);
FilesUploadResult result = imagingApi.uploadFile(uploadFileRequest);
// Update images features in search context
String searchContextId = "5728a4ed-12bb-4b4a-8dce-38295735549f";
String imageId = fileName;
String folder = null; // File is saved at the root of the storage
String storage = null; // We are using default Cloud Storage
PutSearchContextImageFeaturesRequest searchContextImageFeaturesRequest =
new PutSearchContextImageFeaturesRequest(searchContextId, imageId, null, folder, storage);
imagingApi.putSearchContextImageFeatures(searchContextImageFeaturesRequest);
} catch (Exception e) {
System.out.println(e.getMessage());
}