Last active
May 16, 2019 18:42
-
-
Save aspose-cloud/d66d31a62aa65f7dee66a6a655153f47 to your computer and use it in GitHub Desktop.
Aspose.Imaging-Cloud-Java
This file contains 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); | |
try { | |
String searchContextId = "5728a4ed-12bb-4b4a-8dce-38295735549f"; | |
String imageId = "WaterMark.bmp"; | |
// Input image | |
File inputFile = new File(DATA_PATH + imageId); | |
byte[] imageData = new byte[(int) inputFile.length()]; | |
FileInputStream inputStream = new FileInputStream(inputFile); | |
inputStream.read(imageData); | |
String folder = null; | |
String storage = null; | |
PostSearchContextAddImageRequest searchContextAddImageRequest = | |
new PostSearchContextAddImageRequest(searchContextId, imageId, imageData, folder, storage); | |
imagingApi.postSearchContextAddImage(searchContextAddImageRequest); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
This file contains 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); | |
try { | |
String tag = "MyTag"; | |
String imageName = "aspose_logo.png"; | |
String searchContextId = "5728a4ed-12bb-4b4a-8dce-38295735549f"; | |
String folder = null; // File will be saved at the root of the storage | |
String storage = null; // We are using default Cloud Storage | |
// Load tag image as a stream | |
File inputFile = new File(DATA_PATH + imageName); | |
byte[] inputBytes = new byte[(int) inputFile.length()]; | |
FileInputStream inputStream = new FileInputStream(inputFile); | |
inputStream.read(inputBytes); | |
imagingApi.postSearchContextAddTag( | |
new PostSearchContextAddTagRequest(inputBytes, searchContextId, tag, folder, storage)); | |
if (inputStream != null) { | |
inputStream.close(); | |
} | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
This file contains 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
Aspose.Imaging-Cloud-Java |
This file contains 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 imageInStorage1 = "aspose-logo.jpg"; | |
String imageInStorage2 = "aspose_logo.png"; | |
try { | |
// Upload both images to Cloud Storage | |
String[] images = {imageInStorage1, imageInStorage2}; | |
for (String imageName : images) { | |
File inputFile = new File(DATA_PATH + imageName); | |
FileInputStream localInputImageStream = new FileInputStream(inputFile); | |
byte[] localInputImage = IOUtils.toByteArray(localInputImageStream); | |
UploadFileRequest uploadFileRequest = new UploadFileRequest(imageName, localInputImage, null); | |
FilesUploadResult result = imagingApi.uploadFile(uploadFileRequest); | |
} | |
// Compare two images | |
String searchContextId = "5728a4ed-12bb-4b4a-8dce-38295735549f"; | |
String folder = null; // Folder with image to process | |
String storage = null; // We are using default Cloud Storage | |
SearchResultsSet result = imagingApi.postSearchContextCompareImages( | |
new PostSearchContextCompareImagesRequest( | |
searchContextId, imageInStorage1, null, imageInStorage2, folder, storage)); | |
Double similarity = result.getResults().get(0).getSimilarity(); | |
System.out.println("Images Similarity: " + similarity.toString()); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
This file contains 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); | |
try { | |
String detector = "akaze"; | |
String matchingAlgorithm = "randomBinaryTree"; | |
String folder = null; // File will be saved at the root of the storage | |
String storage = null; // We are using default Cloud Storage | |
PostCreateSearchContextRequest createSearchContextRequest = new PostCreateSearchContextRequest(detector, | |
matchingAlgorithm, folder, storage); | |
SearchContextStatus status = imagingApi.postCreateSearchContext(createSearchContextRequest); | |
System.out.println(status); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
This file contains 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 = "Sample.tiff"; | |
try { | |
// Upload local image to Cloud Storage | |
File inputFile = new File(Main.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); | |
Integer frameId = 0; // Number of a frame | |
Integer x = 10; | |
Integer y = 10; | |
Integer rectWidth = 200; | |
Integer rectHeight = 300; | |
// Result will include just the specified frame | |
Boolean saveOtherFrames = false; | |
String outPath = null; // Path to updated file (if this is empty, response contains streamed image). | |
String folder = null; // Input file is saved at the root of the storage | |
String storage = null; // We are using default Cloud Storage | |
GetImageFrameRequest getImageFrameRequest = new GetImageFrameRequest(fileName, frameId, null, null, | |
x, y, rectWidth, rectHeight, null, saveOtherFrames, outPath, folder, storage); | |
byte[] updatedImage = imagingApi.getImageFrame(getImageFrameRequest); | |
// Save updated image to local storage | |
FileOutputStream fos = new FileOutputStream(Main.DATA_PATH + "SingleFrame_out.tiff"); | |
fos.write(updatedImage); | |
fos.close(); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
This file contains 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(Main.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); | |
String format = "jpg"; // Resulting image format. Currently, BMP, PSD, JPG, TIFF, GIF, PNG, J2K and WEBP are supported. | |
Integer x = 10; | |
Integer y = 10; | |
Integer width = 100; | |
Integer height = 150; | |
String outPath = null; // Path to updated file (if this is empty, response contains streamed image) | |
String folder = null; // Input file is saved at the root of the storage | |
String storage = null; // We are using default Cloud Storage | |
GetImageCropRequest getImageCropRequest = new GetImageCropRequest(fileName, format, x, y, | |
width, height, outPath, folder, storage); | |
byte[] updatedImage = imagingApi.getImageCrop(getImageCropRequest); | |
// Save updated image to local storage | |
FileOutputStream fos = new FileOutputStream(Main.DATA_PATH + "Watermark_out." + format); | |
fos.write(updatedImage); | |
fos.close(); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
This file contains 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); | |
try { | |
File file = new File(Main.DATA_PATH + "WaterMark.bmp"); | |
byte[] imageData = Files.readAllBytes(file.toPath()); | |
String format = "jpg"; // Resulting image format. Currently, BMP, PSD, JPG, TIFF, GIF, PNG, J2K and WEBP are supported. | |
Integer x = 10; | |
Integer y = 10; | |
Integer width = 100; | |
Integer height = 150; | |
String outPath = null; // Path to updated file (if this is empty, response contains streamed image) | |
String storage = null; // We are using default Cloud Storage | |
PostImageCropRequest postImageCropRequest = new PostImageCropRequest(imageData, format, x, y, width, height, | |
outPath, storage); | |
byte[] updatedImage = imagingApi.postImageCrop(postImageCropRequest); | |
// Save updated image to local storage | |
FileOutputStream fos = new FileOutputStream(Main.DATA_PATH + "Watermark_out." + format); | |
fos.write(updatedImage); | |
fos.close(); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
This file contains 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); | |
try { | |
String searchContextId = "5728a4ed-12bb-4b4a-8dce-38295735549f"; | |
String imageId = "WaterMark.bmp"; | |
String folder = null; | |
String storage = null; | |
DeleteSearchContextImageRequest searchContextImageRequest = | |
new DeleteSearchContextImageRequest(searchContextId, imageId, folder, storage); | |
imagingApi.deleteSearchContextImage(searchContextImageRequest); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
This file contains 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); | |
try { | |
String searchContextId = "5728a4ed-12bb-4b4a-8dce-38295735549f"; | |
String imageId = "WaterMark.bmp"; | |
String folder = null; // File is saved at the root of the storage | |
String storage = null; // We are using default Cloud Storage | |
DeleteSearchContextImageFeaturesRequest deleteSearchContextImageFeaturesRequest = | |
new DeleteSearchContextImageFeaturesRequest(searchContextId, imageId, folder, storage); | |
imagingApi.deleteSearchContextImageFeatures(deleteSearchContextImageFeaturesRequest); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
This file contains 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); | |
try { | |
String searchContextId = "5728a4ed-12bb-4b4a-8dce-38295735549f"; | |
String folder = null; // File is saved at the root of the storage | |
String storage = null; // We are using default Cloud Storage | |
DeleteSearchContextRequest deleteSearchContextRequest = new DeleteSearchContextRequest(searchContextId, | |
folder, storage); | |
imagingApi.deleteSearchContext(deleteSearchContextRequest); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
This file contains 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); | |
// Input formats could be one of the following: | |
// BMP, GIF, DJVU, WMF, EMF, JPEG, JPEG2000, PSD, TIFF, WEBP, PNG, DICOM, CDR, CMX, ODG, DNG and SVG | |
String fileName = "WaterMark.bmp"; | |
try { | |
// Upload local image to Cloud Storage | |
File inputFile = new File(Main.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); | |
// Output formats could be one of the following: | |
// BMP, GIF, DJVU, WMF, EMF, JPEG, JPEG2000, PSD, TIFF, WEBP, PNG, DICOM, CDR, CMX, ODG, DNG, SVG and PDF | |
String format = "pdf"; | |
String outPath = null; // Path to updated file (if this is empty, response contains streamed image) | |
String folder = null; // Input file is saved at the root of the storage | |
String storage = null; // Cloud Storage name | |
GetImageSaveAsRequest getSaveToStorageRequest = new GetImageSaveAsRequest(fileName, format, outPath, | |
folder, storage); | |
byte[] exportedImage = imagingApi.getImageSaveAs(getSaveToStorageRequest); | |
// Save exported image to local storage | |
FileOutputStream fos = new FileOutputStream(Main.DATA_PATH + "Watermark_out.pdf"); | |
fos.write(exportedImage); | |
fos.close(); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
This file contains 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); | |
try { | |
// Input formats could be one of the following: | |
// BMP, GIF, DJVU, WMF, EMF, JPEG, JPEG2000, PSD, TIFF, WEBP, PNG, DICOM, CDR, CMX, ODG, DNG and SVG | |
File file = new File(Main.DATA_PATH + "WaterMark.bmp"); | |
byte[] imageData = Files.readAllBytes(file.toPath()); | |
// Output formats could be one of the following: | |
// BMP, GIF, DJVU, WMF, EMF, JPEG, JPEG2000, PSD, TIFF, WEBP, PNG, DICOM, CDR, CMX, ODG, DNG, SVG and PDF | |
String format = "pdf"; | |
String outPath = null; // Path to updated file (if this is empty, response contains streamed image) | |
String storage = null; // Cloud Storage name | |
PostImageSaveAsRequest postSaveToStorageRequest = new PostImageSaveAsRequest(imageData, format, | |
outPath, storage); | |
byte[] exportedImage = imagingApi.postImageSaveAs(postSaveToStorageRequest); | |
// Save exported image to local storage | |
FileOutputStream fos = new FileOutputStream(Main.DATA_PATH + "Watermark_out.pdf"); | |
fos.write(exportedImage); | |
fos.close(); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
This file contains 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 Cloud 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); | |
// Extract features from image without adding to search context | |
String searchContextId = "5728a4ed-12bb-4b4a-8dce-38295735549f"; | |
String folder = null; // Folder with image to process | |
String storage = null; // We are using default Cloud Storage | |
GetSearchContextExtractImageFeaturesRequest extractImageFeaturesRequest = | |
new GetSearchContextExtractImageFeaturesRequest(searchContextId, fileName, null, folder, storage); | |
ImageFeatures imageFeatures = imagingApi.getSearchContextExtractImageFeatures(extractImageFeaturesRequest); | |
System.out.println(imageFeatures); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
This file contains 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); | |
try { | |
// The search context identifier. | |
String searchContextId = "5728a4ed-12bb-4b4a-8dce-38295735549f"; | |
// Input image | |
String imageName = "WaterMark.bmp"; | |
File inputFile = new File(DATA_PATH + imageName); | |
byte[] imageData = new byte[(int) inputFile.length()]; | |
FileInputStream inputStream = new FileInputStream(inputFile); | |
inputStream.read(imageData); | |
String imageId = null; //The image identifier | |
String imagesFolder = null; // Images folder | |
String folder = null; | |
String storage = null; // We are using default Cloud Storage | |
PostSearchContextExtractImageFeaturesRequest postSearchContextExtractImageFeaturesRequest = | |
new PostSearchContextExtractImageFeaturesRequest(searchContextId, imageData, imageId, imagesFolder, | |
folder, storage); | |
imagingApi.postSearchContextExtractImageFeatures(postSearchContextExtractImageFeaturesRequest); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
This file contains 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); | |
try { | |
String searchContextId = "5728a4ed-12bb-4b4a-8dce-38295735549f"; | |
Double similarityThreshold = 90.0; | |
String folder = null; // Folder with image to process | |
String storage = null; // We are using default Cloud Storage | |
ImageDuplicatesSet result = imagingApi.getSearchContextFindDuplicates( | |
new GetSearchContextFindDuplicatesRequest(searchContextId, similarityThreshold, folder, storage)); | |
for (ImageDuplicates duplicates : result.getDuplicates()) | |
{ | |
System.out.println("Duplicates:"); | |
for (SearchResult duplicate : duplicates.getDuplicateImages()) | |
{ | |
System.out.println("ImageName: " + duplicate.getImageId() + | |
", Similarity: " + duplicate.getSimilarity()); | |
} | |
} | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
This file contains 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 = "aspose-logo.jpg"; | |
try { | |
// Upload image to Cloud 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); | |
// Find similar images | |
String searchContextId = "5728a4ed-12bb-4b4a-8dce-38295735549f"; | |
Double similarityThreshold = 90.0; | |
Integer maxCount = 5; | |
String folder = null; // Folder with image to process | |
String storage = null; // We are using default Cloud Storage | |
SearchResultsSet results = imagingApi.getSearchContextFindSimilar( | |
new GetSearchContextFindSimilarRequest( | |
searchContextId, similarityThreshold, maxCount, null, fileName, folder, storage)); | |
// process search results | |
for (SearchResult searchResult : results.getResults()) | |
{ | |
System.out.println("ImageName: " + searchResult.getImageId() + | |
", Similarity: " + searchResult.getSimilarity()); | |
} | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
This file contains 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 = "Sample.tiff"; | |
try { | |
// Upload local image to Cloud Storage | |
File inputFile = new File(Main.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); | |
Integer frameId = 1; // Number of a frame | |
Integer newWidth = 300; | |
Integer newHeight = 450; | |
Integer x = 10; | |
Integer y = 10; | |
Integer rectWidth = 200; | |
Integer rectHeight = 300; | |
String rotateFlipMethod = "Rotate90FlipX"; | |
// Result will include just the specified frame | |
Boolean saveOtherFrames = false; | |
String outPath = null; // Path to updated file (if this is empty, response contains streamed image). | |
String folder = null; // Input file is saved at the root of the storage | |
String storage = null; // We are using default Cloud Storage | |
GetImageFrameRequest getImageFrameRequest = new GetImageFrameRequest(fileName, frameId, newWidth, newHeight, | |
x, y, rectWidth, rectHeight, rotateFlipMethod, saveOtherFrames, outPath, folder, storage); | |
byte[] updatedImage = imagingApi.getImageFrame(getImageFrameRequest); | |
// Save updated image to local storage | |
FileOutputStream fos = new FileOutputStream(Main.DATA_PATH + "SingleFrame_out.tiff"); | |
fos.write(updatedImage); | |
fos.close(); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
This file contains 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); | |
try { | |
File file = new File(Main.DATA_PATH + "Sample.tiff"); | |
byte[] imageData = Files.readAllBytes(file.toPath()); | |
Integer frameId = 1; | |
Integer newWidth = 300; | |
Integer newHeight = 450; | |
Integer x = 10; | |
Integer y = 10; | |
Integer rectWidth = 200; | |
Integer rectHeight = 300; | |
String rotateFlipMethod = "Rotate90FlipX"; | |
Boolean saveOtherFrames = false; | |
String outPath = null; // Path to updated file (if this is empty, response contains streamed image). | |
String storage = null; // We are using default Cloud Storage | |
PostImageFrameRequest postImageFrameRequest = new PostImageFrameRequest(imageData, frameId, newWidth, | |
newHeight, x, y, rectWidth, rectHeight, rotateFlipMethod, saveOtherFrames, outPath, storage); | |
byte[] updatedImage = imagingApi.postImageFrame(postImageFrameRequest); | |
// Save updated image to local storage | |
FileOutputStream fos = new FileOutputStream(Main.DATA_PATH + "SingleFrame_out.tiff"); | |
fos.write(updatedImage); | |
fos.close(); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
This file contains 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 = "Sample.tiff"; | |
try { | |
// Upload local image to Cloud Storage | |
File inputFile = new File(Main.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); | |
Integer frameId = 1; // Number of a frame | |
String folder = null; // Input file is saved at the root of the storage | |
String storage = null; // We are using default Cloud Storage | |
GetImageFramePropertiesRequest imageFramePropertiesRequest = new GetImageFramePropertiesRequest(fileName, | |
frameId, folder, storage); | |
ImagingResponse imagingResponse = imagingApi.getImageFrameProperties(imageFramePropertiesRequest); | |
System.out.println("Width: " + imagingResponse.getHeight() + " Height: " + imagingResponse.getWidth()); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
This file contains 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); | |
try { | |
File file = new File(Main.DATA_PATH + "Sample.tiff"); | |
byte[] imageData = Files.readAllBytes(file.toPath()); | |
Integer frameId = 1; | |
PostImageFramePropertiesRequest imageFramePropertiesRequest = new PostImageFramePropertiesRequest(imageData, | |
frameId); | |
ImagingResponse imagingResponse = imagingApi.postImageFrameProperties(imageFramePropertiesRequest); | |
System.out.println("Width: " + imagingResponse.getHeight() + " Height: " + imagingResponse.getWidth()); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
This file contains 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); | |
try { | |
String searchContextId = "5728a4ed-12bb-4b4a-8dce-38295735549f"; | |
String imageId = "WaterMark.bmp"; | |
String folder = null; // File is saved at the root of the storage | |
String storage = null; // We are using default Cloud Storage | |
GetSearchContextImageFeaturesRequest getSearchContextImageFeaturesRequest = | |
new GetSearchContextImageFeaturesRequest(searchContextId, imageId, folder, storage); | |
ImageFeatures imageFeatures = imagingApi.getSearchContextImageFeatures(getSearchContextImageFeaturesRequest); | |
System.out.println(imageFeatures); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
This file contains 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); | |
try { | |
String searchContextId = "5728a4ed-12bb-4b4a-8dce-38295735549f"; | |
String imageId = "WaterMark.bmp"; | |
String folder = null; | |
String storage = null; | |
GetSearchContextImageRequest getSearchContextImageRequest = | |
new GetSearchContextImageRequest(searchContextId, imageId, folder, storage); | |
byte[] retrievedImage = imagingApi.getSearchContextImage(getSearchContextImageRequest); | |
// Save retrieved image to local storage | |
FileOutputStream fos = new FileOutputStream(DATA_PATH + "Watermark_out.bmp"); | |
fos.write(retrievedImage); | |
fos.close(); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
This file contains 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 = "Sample.tiff"; | |
try { | |
// Upload local image to Cloud Storage | |
File inputFile = new File(Main.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); | |
Integer frameId = 1; // Number of a frame | |
Integer newWidth = 300; | |
Integer newHeight = 450; | |
Integer x = 10; | |
Integer y = 10; | |
Integer rectWidth = 200; | |
Integer rectHeight = 300; | |
String rotateFlipMethod = "Rotate90FlipX"; | |
// Result will include all other frames | |
Boolean saveOtherFrames = true; | |
String outPath = null; // Path to updated file (if this is empty, response contains streamed image). | |
String folder = null; // Input file is saved at the root of the storage | |
String storage = null; // We are using default Cloud Storage | |
GetImageFrameRequest getImageFrameRequest = new GetImageFrameRequest(fileName, frameId, newWidth, newHeight, | |
x, y, rectWidth, rectHeight, rotateFlipMethod, saveOtherFrames, outPath, folder, storage); | |
byte[] updatedImage = imagingApi.getImageFrame(getImageFrameRequest); | |
// Save updated image to local storage | |
FileOutputStream fos = new FileOutputStream(Main.DATA_PATH + "OtherFrames_out.tiff"); | |
fos.write(updatedImage); | |
fos.close(); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
This file contains 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 = "Sample.tiff"; | |
try { | |
// Upload local image to Cloud Storage | |
File inputFile = new File(Main.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); | |
// Get properties of an image | |
// Folder with image to process. The value is null because the file is saved at the root of the storage | |
String folder = null; | |
String storage = null; // We are using default Cloud Storage | |
GetImagePropertiesRequest getImagePropertiesRequest = new GetImagePropertiesRequest(fileName, folder, | |
storage); | |
ImagingResponse imagingResponse = imagingApi.getImageProperties(getImagePropertiesRequest); | |
System.out.println(imagingResponse); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
This file contains 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); | |
try { | |
File file = new File(Main.DATA_PATH + "Sample.tiff"); | |
byte[] imageData = Files.readAllBytes(file.toPath()); | |
PostImagePropertiesRequest imagePropertiesRequest = new PostImagePropertiesRequest(imageData); | |
ImagingResponse imagingResponse = imagingApi.postImageProperties(imagePropertiesRequest); | |
System.out.println(imagingResponse); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
This file contains 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); | |
try { | |
String searchContextId = "5728a4ed-12bb-4b4a-8dce-38295735549f"; | |
String folder = null; // File is saved at the root of the storage | |
String storage = null; // We are using default Cloud Storage | |
GetSearchContextStatusRequest searchContextStatusRequest = new GetSearchContextStatusRequest(searchContextId, | |
folder, storage); | |
SearchContextStatus status = imagingApi.getSearchContextStatus(searchContextStatusRequest); | |
System.out.println(status.getSearchStatus()); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
This file contains 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 = "Sample.tiff"; // Original image file name | |
String appendFileName = "Memorandum.tif"; // Image file name to be appended to original one | |
try { | |
// Upload original image file to cloud storage | |
File inputFile = new File(Main.DATA_PATH + fileName); | |
FileInputStream localInputImageStream = new FileInputStream(inputFile); | |
byte[] localInputImage = IOUtils.toByteArray(localInputImageStream); | |
UploadFileRequest uploadFileRequest = new UploadFileRequest(fileName, localInputImage, null); | |
FilesUploadResult inputFileResult = imagingApi.uploadFile(uploadFileRequest); | |
// Upload file be appended to cloud storage | |
File appendFile = new File(Main.DATA_PATH + appendFileName); | |
FileInputStream appendFileImageStream = new FileInputStream(appendFile); | |
byte[] appendFileImage = IOUtils.toByteArray(appendFileImageStream); | |
UploadFileRequest uploadAppendFileRequest = new UploadFileRequest(appendFileName, appendFileImage, null); | |
FilesUploadResult appendFileResult = imagingApi.uploadFile(uploadAppendFileRequest); | |
// Update TIFF Image parameters according to fax parameters | |
String folder = null; // Input file is saved at the root of the storage | |
String storage = null; // We are using default Cloud Storage | |
PostTiffAppendRequest request = new PostTiffAppendRequest(fileName, appendFileName, storage, folder); | |
imagingApi.postTiffAppend(request); | |
// Download updated file to local storage | |
DownloadFileRequest downloadFileRequest = new DownloadFileRequest(fileName, storage, null); | |
byte[] updatedImage = imagingApi.downloadFile(downloadFileRequest); | |
// Save updated image to local storage | |
FileOutputStream fos = new FileOutputStream(Main.DATA_PATH + "Sample_out.tiff"); | |
fos.write(updatedImage); | |
fos.close(); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
This file contains 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 = "Sample.emf"; | |
try { | |
// Upload local image to storage | |
File inputFile = new File(Main.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 EMF Image properties | |
String bkColor = "gray"; | |
Integer pageWidth = 300; | |
Integer pageHeight = 300; | |
Integer borderX = 50; | |
Integer borderY = 50; | |
String format = "png"; | |
// Specifies where additional parameters we do not support should be taken from. | |
// If this is true – they will be taken from default values for standard image, | |
// if it is false – they will be saved from current image. Default is false. | |
Boolean fromScratch = null; | |
String outPath = null; // Path to updated file (if this is empty, response contains streamed image) | |
String folder = null; // Input file is saved at the root of the storage | |
String storage = null; // As we are using default Cloud Storage | |
GetImageEmfRequest getImageEmfRequest = new GetImageEmfRequest(fileName, bkColor, pageWidth, pageHeight, | |
borderX, borderY, fromScratch, outPath, folder, storage, format); | |
byte[] updatedImage = imagingApi.getImageEmf(getImageEmfRequest); | |
// Save updated image to local storage | |
FileOutputStream fos = new FileOutputStream(Main.DATA_PATH + "SampleEMF_out.png"); | |
fos.write(updatedImage); | |
fos.close(); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
This file contains 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); | |
try { | |
File file = new File(Main.DATA_PATH + "Sample.emf"); | |
byte[] imageData = Files.readAllBytes(file.toPath()); | |
String bkColor = "gray"; | |
Integer pageWidth = 300; | |
Integer pageHeight = 300; | |
Integer borderX = 50; | |
Integer borderY = 50; | |
String format = "png"; | |
Boolean fromScratch = null; | |
String outPath = null; // Path to updated file (if this is empty, response contains streamed image) | |
String storage = null; // As we are using default Cloud Storage | |
PostImageEmfRequest postImageEmfRequest = new PostImageEmfRequest(imageData, bkColor, pageWidth, pageHeight, | |
borderX, borderY, fromScratch, outPath, storage, format); | |
byte[] updatedImage = imagingApi.postImageEmf(postImageEmfRequest); | |
// Save updated image to local storage | |
FileOutputStream fos = new FileOutputStream(Main.DATA_PATH + "SampleEMF_out.png"); | |
fos.write(updatedImage); | |
fos.close(); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
This file contains 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 = "Sample.psd"; | |
try { | |
// Upload local image to Cloud Storage | |
File inputFile = new File(Main.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); | |
String format = "gif"; | |
Integer newWidth = 100; | |
Integer newHeight = 150; | |
String outPath = null; // Path to updated file (if this is empty, response contains streamed image). | |
String folder = null; // Folder with image to process. | |
String storage = null; // We are using default Cloud Storage | |
GetImageResizeRequest getImageResizeRequest = new GetImageResizeRequest(fileName, format, newWidth, | |
newHeight, outPath, folder, storage); | |
byte[] updatedImage = imagingApi.getImageResize(getImageResizeRequest); | |
// Save updated image to local storage | |
FileOutputStream fos = new FileOutputStream(Main.DATA_PATH + "Sample_out.gif"); | |
fos.write(updatedImage); | |
fos.close(); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
This file contains 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); | |
try { | |
File file = new File(Main.DATA_PATH + "Sample.psd"); | |
byte[] imageData = Files.readAllBytes(file.toPath()); | |
String format = "gif"; | |
Integer newWidth = 100; | |
Integer newHeight = 150; | |
String outPath = null; // Path to updated file (if this is empty, response contains streamed image). | |
String folder = null; | |
String storage = null; // We are using default Cloud Storage | |
PostImageResizeRequest postImageResizeRequest = new PostImageResizeRequest(imageData, format, newWidth, | |
newHeight, outPath, storage); | |
byte[] updatedImage = imagingApi.postImageResize(postImageResizeRequest); | |
// Save updated image to local storage | |
FileOutputStream fos = new FileOutputStream(Main.DATA_PATH + "Sample_out.gif"); | |
fos.write(updatedImage); | |
fos.close(); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
This file contains 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 = "Sample.tiff"; | |
try { | |
// Upload local image to Cloud Storage | |
File inputFile = new File(Main.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); | |
Integer frameId = 0; // Number of a frame | |
Integer newWidth = 300; | |
Integer newHeight = 300; | |
// Result will include just the specified frame | |
Boolean saveOtherFrames = false; | |
String outPath = null; // Path to updated file (if this is empty, response contains streamed image). | |
String folder = null; // Input file is saved at the root of the storage | |
String storage = null; // We are using default Cloud Storage | |
GetImageFrameRequest getImageFrameRequest = new GetImageFrameRequest(fileName, frameId, newWidth, newHeight, | |
null, null, null, null, null, saveOtherFrames, outPath, folder, storage); | |
byte[] updatedImage = imagingApi.getImageFrame(getImageFrameRequest); | |
// Save updated image to local storage | |
FileOutputStream fos = new FileOutputStream(Main.DATA_PATH + "SingleFrame_out.tiff"); | |
fos.write(updatedImage); | |
fos.close(); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
This file contains 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 = "Sample.psd"; | |
try { | |
// Upload local image to Cloud Storage | |
File inputFile = new File(Main.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); | |
String format = "gif"; | |
String method = "Rotate90FlipX"; // RotateFlip method | |
String outPath = null; // Path to updated file (if this is empty, response contains streamed image). | |
String folder = null; // Folder with image to process. | |
String storage = null; // We are using default Cloud Storage | |
GetImageRotateFlipRequest getImageRotateFlipRequest = new GetImageRotateFlipRequest(fileName, format, | |
method, outPath, folder, storage); | |
byte[] updatedImage = imagingApi.getImageRotateFlip(getImageRotateFlipRequest); | |
// Save updated image to local storage | |
FileOutputStream fos = new FileOutputStream(Main.DATA_PATH + "Sample_out.gif"); | |
fos.write(updatedImage); | |
fos.close(); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
This file contains 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); | |
try { | |
File file = new File(Main.DATA_PATH + "Sample.psd"); | |
byte[] imageData = Files.readAllBytes(file.toPath()); | |
String format = "gif"; | |
String method = "Rotate90FlipX"; // RotateFlip method | |
String outPath = null; // Path to updated file (if this is empty, response contains streamed image). | |
String storage = null; // We are using default Cloud Storage | |
PostImageRotateFlipRequest postImageRotateFlipRequest = new PostImageRotateFlipRequest(imageData, format, | |
method, outPath, storage); | |
byte[] updatedImage = imagingApi.postImageRotateFlip(postImageRotateFlipRequest); | |
// Save updated image to local storage | |
FileOutputStream fos = new FileOutputStream(Main.DATA_PATH + "Sample_out.gif"); | |
fos.write(updatedImage); | |
fos.close(); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
This file contains 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 = "Sample.tiff"; | |
try { | |
// Upload local image to Cloud Storage | |
File inputFile = new File(Main.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); | |
Integer frameId = 0; // Number of a frame | |
String rotateFlipMethod = "Rotate90FlipX"; | |
// Result will include just the specified frame | |
Boolean saveOtherFrames = false; | |
String outPath = null; // Path to updated file (if this is empty, response contains streamed image). | |
String folder = null; // Input file is saved at the root of the storage | |
String storage = null; // We are using default Cloud Storage | |
GetImageFrameRequest getImageFrameRequest = new GetImageFrameRequest(fileName, frameId, null, null, | |
null, null, null, null, rotateFlipMethod, saveOtherFrames, outPath, folder, storage); | |
byte[] updatedImage = imagingApi.getImageFrame(getImageFrameRequest); | |
// Save updated image to local storage | |
FileOutputStream fos = new FileOutputStream(Main.DATA_PATH + "SingleFrame_out.tiff"); | |
fos.write(updatedImage); | |
fos.close(); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
This file contains 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 = "Sample.tiff"; | |
try { | |
// Upload local image to Cloud Storage | |
File inputFile = new File(Main.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); | |
Integer frameId = 0; // Number of a frame | |
Integer newWidth = 300; | |
Integer newHeight = 450; | |
Integer x = 10; | |
Integer y = 10; | |
Integer rectWidth = 200; | |
Integer rectHeight = 300; | |
String rotateFlipMethod = "Rotate90FlipX"; | |
// Result will include just the specified frame | |
Boolean saveOtherFrames = true; | |
String outPath = null; // Path to updated file (if this is empty, response contains streamed image). | |
String folder = null; // Input file is saved at the root of the storage | |
String storage = null; // We are using default Cloud Storage | |
GetImageFrameRequest getImageFrameRequest = new GetImageFrameRequest(fileName, frameId, newWidth, newHeight, | |
x, y, rectWidth, rectHeight, rotateFlipMethod, saveOtherFrames, outPath, folder, storage); | |
byte[] updatedImage = imagingApi.getImageFrame(getImageFrameRequest); | |
// Save updated image to local storage | |
FileOutputStream fos = new FileOutputStream(Main.DATA_PATH + "SingleFrame_out.tiff"); | |
fos.write(updatedImage); | |
fos.close(); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
This file contains 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); | |
try { | |
String searchContextId = "5728a4ed-12bb-4b4a-8dce-38295735549f"; | |
String imageId = "WaterMark.bmp"; | |
byte[] imageData = null; | |
String folder = null; | |
String storage = null; | |
PutSearchContextImageRequest searchContextImageRequest = | |
new PutSearchContextImageRequest(searchContextId, imageId, imageData, folder, storage); | |
imagingApi.putSearchContextImage(searchContextImageRequest); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
This file contains 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()); | |
} |
This file contains 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 = "Sample.gif"; | |
try { | |
// Upload local image to Cloud Storage | |
File inputFile = new File(Main.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); | |
String format = "pdf"; | |
Integer newWidth = 300; | |
Integer newHeight = 450; | |
Integer x = 10; | |
Integer y = 10; | |
Integer rectWidth = 200; | |
Integer rectHeight = 300; | |
String rotateFlipMethod = "Rotate90FlipX"; | |
String outPath = null; // Path to updated file (if this is empty, response contains streamed image) | |
String folder = null; // Input file is saved at the root of the storage | |
String storage = null; // We are using default Cloud Storage | |
GetImageUpdateRequest getImageUpdateRequest = new GetImageUpdateRequest(fileName, format, newWidth, | |
newHeight, x, y, rectWidth, rectHeight, rotateFlipMethod, outPath, folder, storage); | |
byte[] updatedImage = imagingApi.getImageUpdate(getImageUpdateRequest);; | |
// Save updated image to local storage | |
FileOutputStream fos = new FileOutputStream(Main.DATA_PATH + "Sample_out." + format); | |
fos.write(updatedImage); | |
fos.close(); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
This file contains 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); | |
try { | |
File file = new File(Main.DATA_PATH + "Sample.gif"); | |
byte[] imageData = Files.readAllBytes(file.toPath()); | |
String format = "pdf"; | |
Integer newWidth = 300; | |
Integer newHeight = 450; | |
Integer x = 10; | |
Integer y = 10; | |
Integer rectWidth = 200; | |
Integer rectHeight = 300; | |
String rotateFlipMethod = "Rotate90FlipX"; | |
String outPath = null; // Path to updated file (if this is empty, response contains streamed image) | |
String storage = null; // We are using default Cloud Storage | |
PostImageUpdateRequest postImageUpdateRequest = new PostImageUpdateRequest(imageData, format, newWidth, | |
newHeight, x, y, rectWidth, rectHeight, rotateFlipMethod, outPath, storage); | |
byte[] updatedImage = imagingApi.postImageUpdate(postImageUpdateRequest); | |
// Save updated image to local storage | |
FileOutputStream fos = new FileOutputStream(Main.DATA_PATH + "Sample_out." + format); | |
fos.write(updatedImage); | |
fos.close(); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
This file contains 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 Cloud Storage | |
File inputFile = new File(Main.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); | |
Integer bitsPerPixel = 32; | |
Integer horizontalResolution = 300; | |
Integer verticalResolution = 300; | |
Boolean fromScratch = null; | |
String outPath = null; // Path to updated file (if this is empty, response contains streamed image) | |
String folder = null; // Input file is saved at the root of the storage | |
String storage = null; // We are using default Cloud Storage | |
GetImageBmpRequest getImageBmpRequest = new GetImageBmpRequest(fileName, bitsPerPixel, horizontalResolution, | |
verticalResolution, fromScratch, outPath, folder, storage); | |
byte[] updatedImage = imagingApi.getImageBmp(getImageBmpRequest); | |
// Save updated image to local storage | |
FileOutputStream fos = new FileOutputStream(Main.DATA_PATH + "Watermark_out.bmp"); | |
fos.write(updatedImage); | |
fos.close(); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
This file contains 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); | |
try { | |
File file = new File(Main.DATA_PATH + "WaterMark.bmp"); | |
byte[] imageData = Files.readAllBytes(file.toPath()); | |
Integer bitsPerPixel = 32; | |
Integer horizontalResolution = 300; | |
Integer verticalResolution = 300; | |
Boolean fromScratch = null; | |
String outPath = null; // Path to updated file (if this is empty, response contains streamed image) | |
String storage = null; // We are using default Cloud Storage | |
PostImageBmpRequest postImageBmpRequest = new PostImageBmpRequest(imageData, bitsPerPixel, | |
horizontalResolution, verticalResolution, fromScratch, outPath, storage); | |
byte[] updatedImage = imagingApi.postImageBmp(postImageBmpRequest); | |
// Save updated image to local storage | |
FileOutputStream fos = new FileOutputStream(Main.DATA_PATH + "Watermark_out.bmp"); | |
fos.write(updatedImage); | |
fos.close(); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
This file contains 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 = "Sample.gif"; | |
try { | |
// Upload local image to Cloud Storage | |
File inputFile = new File(Main.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); | |
Integer backgroundColorIndex = 5; | |
Integer colorResolution = 4; | |
Boolean hasTrailer = true; | |
Boolean interlaced = false; | |
Boolean isPaletteSorted = true; | |
Integer pixelAspectRatio = 4; | |
Boolean fromScratch = null; | |
String outPath = null; // Path to updated file (if this is empty, response contains streamed image) | |
String folder = null; // Input file is saved at the root of the storage | |
String storage = null; // We are using default Cloud Storage | |
GetImageGifRequest getImageGifRequest = new GetImageGifRequest(fileName, backgroundColorIndex, | |
colorResolution, hasTrailer, interlaced, isPaletteSorted, | |
pixelAspectRatio, fromScratch, outPath, folder, storage); | |
byte[] updatedImage = imagingApi.getImageGif(getImageGifRequest); | |
// Save updated image to local storage | |
FileOutputStream fos = new FileOutputStream(Main.DATA_PATH + "Sample_out.gif"); | |
fos.write(updatedImage); | |
fos.close(); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
This file contains 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); | |
try { | |
File file = new File(Main.DATA_PATH + "Sample.gif"); | |
byte[] imageData = Files.readAllBytes(file.toPath()); | |
Integer backgroundColorIndex = 5; | |
Integer colorResolution = 4; | |
Boolean hasTrailer = true; | |
Boolean interlaced = false; | |
Boolean isPaletteSorted = true; | |
Integer pixelAspectRatio = 4; | |
Boolean fromScratch = null; | |
String outPath = null; | |
String storage = null; // We are using default Cloud Storage | |
PostImageGifRequest postImageGifRequest = new PostImageGifRequest(imageData, backgroundColorIndex, | |
colorResolution, hasTrailer, interlaced, isPaletteSorted, pixelAspectRatio, | |
fromScratch, outPath, storage); | |
byte[] updatedImage = imagingApi.postImageGif(postImageGifRequest); | |
// Save updated image to local storage | |
FileOutputStream fos = new FileOutputStream(Main.DATA_PATH + "Sample_out.gif"); | |
fos.write(updatedImage); | |
fos.close(); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
This file contains 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 = "Sample.jp2"; | |
try { | |
// Upload local image to Cloud Storage | |
File inputFile = new File(Main.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); | |
String codec = "jp2"; | |
String comment = "Aspose"; | |
Boolean fromScratch = null; | |
String outPath = null; // Path to updated file (if this is empty, response contains streamed image) | |
String folder = null; // Input file is saved at the root of the storage | |
String storage = null; // We are using default Cloud Storage | |
GetImageJpeg2000Request getImageJpeg2000Request = new GetImageJpeg2000Request(fileName, comment, codec, | |
fromScratch, outPath, folder, storage); | |
byte[] updatedImage = imagingApi.getImageJpeg2000(getImageJpeg2000Request); | |
// Save updated image to local storage | |
FileOutputStream fos = new FileOutputStream(Main.DATA_PATH + "Sample_out.jp2"); | |
fos.write(updatedImage); | |
fos.close(); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
This file contains 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); | |
try { | |
File file = new File(Main.DATA_PATH + "Sample.jp2"); | |
byte[] imageData = Files.readAllBytes(file.toPath()); | |
String codec = "jp2"; | |
String comment = "Aspose"; | |
Boolean fromScratch = null; | |
String outPath = null; // Path to updated file (if this is empty, response contains streamed image) | |
String storage = null; // We are using default Cloud Storage | |
PostImageJpeg2000Request postImageJpeg2000Request = new PostImageJpeg2000Request(imageData, comment, codec, | |
fromScratch, outPath, storage); | |
byte[] updatedImage = imagingApi.postImageJpeg2000(postImageJpeg2000Request); | |
// Save updated image to local storage | |
FileOutputStream fos = new FileOutputStream(Main.DATA_PATH + "Sample_out.jp2"); | |
fos.write(updatedImage); | |
fos.close(); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
This file contains 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 = "aspose-logo.jpg"; | |
try { | |
// Upload local image to Cloud Storage | |
File inputFile = new File(Main.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); | |
int quality = 65; | |
String compressionType = "progressive"; | |
Boolean fromScratch = null; | |
String outPath = null; // Path to updated file (if this is empty, response contains streamed image) | |
String folder = null; // Folder with image to process | |
String storage = null; // We are using default Cloud Storage | |
GetImageJpgRequest getImageJpgRequest = new GetImageJpgRequest(fileName, quality, compressionType, | |
fromScratch, outPath, folder, storage); | |
byte[] updatedImage = imagingApi.getImageJpg(getImageJpgRequest); | |
// Save updated image to local storage | |
FileOutputStream fos = new FileOutputStream(Main.DATA_PATH + "Sample_out.jpg"); | |
fos.write(updatedImage); | |
fos.close(); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
This file contains 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); | |
try { | |
File file = new File(Main.DATA_PATH + "aspose-logo.jpg"); | |
byte[] imageData = Files.readAllBytes(file.toPath()); | |
int quality = 65; | |
String compressionType = "progressive"; | |
Boolean fromScratch = null; | |
String outPath = null; // Path to updated file (if this is empty, response contains streamed image) | |
String storage = null; // We are using default Cloud Storage | |
PostImageJpgRequest postImageJpgRequest = new PostImageJpgRequest(imageData, quality, compressionType, | |
fromScratch, outPath, storage); | |
byte[] updatedImage = imagingApi.postImageJpg(postImageJpgRequest);; | |
// Save updated image to local storage | |
FileOutputStream fos = new FileOutputStream(Main.DATA_PATH + "Sample_out.jpg"); | |
fos.write(updatedImage); | |
fos.close(); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
This file contains 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 = "Sample.psd"; | |
try { | |
// Upload local image to Cloud Storage | |
File inputFile = new File(Main.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); | |
int channelsCount = 3; | |
String compressionMethod = "raw"; | |
Boolean fromScratch = null; | |
String outPath = null; // Path to updated file (if this is empty, response contains streamed image). | |
String folder = null; | |
String storage = null; // We are using default Cloud Storage | |
GetImagePsdRequest getImagePsdRequest = new GetImagePsdRequest(fileName, channelsCount, compressionMethod, | |
fromScratch, outPath, folder, storage); | |
byte[] updatedImage = imagingApi.getImagePsd(getImagePsdRequest); | |
// Save updated image to local storage | |
FileOutputStream fos = new FileOutputStream(Main.DATA_PATH + "Sample_out.psd"); | |
fos.write(updatedImage); | |
fos.close(); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
This file contains 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); | |
try { | |
File file = new File(Main.DATA_PATH + "Sample.psd"); | |
byte[] imageData = Files.readAllBytes(file.toPath()); | |
int channelsCount = 3; | |
String compressionMethod = "raw"; | |
Boolean fromScratch = null; | |
String outPath = null; // Path to updated file (if this is empty, response contains streamed image). | |
String storage = null; // We are using default Cloud Storage | |
PostImagePsdRequest postImagePsdRequest = new PostImagePsdRequest(imageData, channelsCount, | |
compressionMethod, fromScratch, outPath, storage); | |
byte[] updatedImage = imagingApi.postImagePsd(postImagePsdRequest); | |
// Save updated image to local storage | |
FileOutputStream fos = new FileOutputStream(Main.DATA_PATH + "Sample_out.psd"); | |
fos.write(updatedImage); | |
fos.close(); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
This file contains 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 = "Sample.tiff"; | |
try { | |
// Upload local image to Cloud Storage | |
File inputFile = new File(Main.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 TIFF Image parameters according to fax parameters | |
String outPath = null; // Path to updated file (if this is empty, response contains streamed image) | |
String folder = null; // Input file is saved at the root of the storage | |
String storage = null; // We are using default Cloud Storage | |
GetTiffToFaxRequest getTiffToFaxRequest = new GetTiffToFaxRequest(fileName, storage, folder, outPath); | |
byte[] updatedImage = imagingApi.getTiffToFax(getTiffToFaxRequest); | |
// Save updated image to local storage | |
FileOutputStream fos = new FileOutputStream(Main.DATA_PATH + "Sample_out.tiff"); | |
fos.write(updatedImage); | |
fos.close(); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
This file contains 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 = "Sample.tiff"; | |
try { | |
// Upload local image to Cloud Storage | |
File inputFile = new File(Main.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 parameters of TIFF image | |
String compression = "adobedeflate"; | |
String resolutionUnit = "inch"; | |
int bitDepth = 1; | |
double horizontalResolution = 150; | |
double verticalResolution = 150; | |
Boolean fromScratch = null; | |
String outPath = null; // Path to updated file (if this is empty, response contains streamed image) | |
String folder = null; // Input file is saved at the root of the storage | |
String storage = null; // We are using default Cloud Storage | |
GetImageTiffRequest getImageTiffRequest = new GetImageTiffRequest(fileName, compression, resolutionUnit, | |
bitDepth, fromScratch, horizontalResolution, verticalResolution, outPath, folder, storage); | |
byte[] updatedImage = imagingApi.getImageTiff(getImageTiffRequest); | |
// Save updated image to local storage | |
FileOutputStream fos = new FileOutputStream(Main.DATA_PATH + "Sample_out.tiff"); | |
fos.write(updatedImage); | |
fos.close(); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
This file contains 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); | |
try { | |
File file = new File(Main.DATA_PATH + "Sample.tiff"); | |
byte[] imageData = Files.readAllBytes(file.toPath()); | |
String compression = "adobedeflate"; | |
String resolutionUnit = "inch"; | |
int bitDepth = 1; | |
double horizontalResolution = 150; | |
double verticalResolution = 150; | |
Boolean fromScratch = null; | |
String outPath = null; | |
String storage = null; // We are using default Cloud Storage | |
String folder = null; // Input file is saved at the root of the storage | |
PostImageTiffRequest postImageTiffRequest = new PostImageTiffRequest(imageData, compression, | |
resolutionUnit, bitDepth, fromScratch, horizontalResolution, verticalResolution, | |
outPath, storage); | |
byte[] updatedImage = imagingApi.postImageTiff(postImageTiffRequest); | |
// Save updated image to local storage | |
FileOutputStream fos = new FileOutputStream(Main.DATA_PATH + "Sample_out.tiff"); | |
fos.write(updatedImage); | |
fos.close(); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
This file contains 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 = "asposelogo.webp"; | |
try { | |
// Upload local image to Cloud Storage | |
File inputFile = new File(Main.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); | |
Boolean lossless = true; | |
Integer quality = 90; | |
Integer animLoopCount = 5; | |
String animBackgroundColor = "gray"; | |
// Specifies where additional parameters we do not support should be taken from. | |
// If this is true – they will be taken from default values for standard image, | |
// if it is false – they will be saved from current image. Default is false. | |
Boolean fromScratch = null; | |
String outPath = null; // Path to updated file (if this is empty, response contains streamed image). | |
// Folder with image to process. The value is null because the file is saved at the root of the storage | |
String folder = null; | |
String storage = null; // We are using default Cloud Storage | |
GetImageWebPRequest getImageWebPRequest = new GetImageWebPRequest(fileName, lossless, quality, | |
animLoopCount, animBackgroundColor, fromScratch, outPath, folder, storage); | |
byte[] updatedImage = imagingApi.getImageWebP(getImageWebPRequest); | |
// Save updated image to local storage | |
FileOutputStream fos = new FileOutputStream(Main.DATA_PATH + "asposelogo_out.webp"); | |
fos.write(updatedImage); | |
fos.close(); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
This file contains 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); | |
try { | |
File file = new File(Main.DATA_PATH + "asposelogo.webp"); | |
byte[] imageData = Files.readAllBytes(file.toPath()); | |
Boolean lossless = true; | |
Integer quality = 90; | |
Integer animLoopCount = 5; | |
String animBackgroundColor = "gray"; | |
Boolean fromScratch = null; | |
String outPath = null; // Path to updated file (if this is empty, response contains streamed image). | |
String storage = null; // We are using default Cloud Storage | |
PostImageWebPRequest postImageWebPRequest = new PostImageWebPRequest(imageData, lossless, quality, | |
animLoopCount, animBackgroundColor, fromScratch, outPath, storage); | |
byte[] updatedImage = imagingApi.postImageWebP(postImageWebPRequest); | |
// Save updated image to local storage | |
FileOutputStream fos = new FileOutputStream(Main.DATA_PATH + "asposelogo_out.webp"); | |
fos.write(updatedImage); | |
fos.close(); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
This file contains 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 = "Sample.wmf"; | |
try { | |
// Upload local image to Cloud Storage | |
File inputFile = new File(Main.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); | |
String bkColor = "gray"; | |
Integer pageWidth = 300; | |
Integer pageHeight = 300; | |
Integer borderX = 50; | |
Integer borderY = 50; | |
Boolean fromScratch = null; | |
String outPath = null; // Path to updated file (if this is empty, response contains streamed image). | |
// Folder with image to process. The value is null because the file is saved at the root of the storage | |
String folder = null; | |
String storage = null; // We are using default Cloud Storage | |
String exportFormat = "png"; | |
GetImageWmfRequest getImageWmfRequest = new GetImageWmfRequest(fileName, bkColor, pageWidth, pageHeight, | |
borderX, borderY, fromScratch, outPath, folder, | |
storage, exportFormat); | |
byte[] updatedImage = imagingApi.getImageWmf(getImageWmfRequest); | |
// Save updated image to local storage | |
FileOutputStream fos = new FileOutputStream(Main.DATA_PATH + "WMFToPNG_out.png"); | |
fos.write(updatedImage); | |
fos.close(); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
This file contains 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); | |
try { | |
File file = new File(Main.DATA_PATH + "Sample.wmf"); | |
byte[] imageData = Files.readAllBytes(file.toPath()); | |
String bkColor = "gray"; | |
Integer pageWidth = 300; | |
Integer pageHeight = 300; | |
Integer borderX = 50; | |
Integer borderY = 50; | |
Boolean fromScratch = null; | |
String outPath = null; // Path to updated file (if this is empty, response contains streamed image). | |
String storage = null; // We are using default Cloud Storage | |
String exportFormat = "png"; | |
PostImageWmfRequest postImageWmfRequest = new PostImageWmfRequest(imageData, bkColor, pageWidth, | |
pageHeight, borderX, borderY, fromScratch, outPath, | |
storage, exportFormat); | |
byte[] updatedImage = imagingApi.postImageWmf(postImageWmfRequest); | |
// Save updated image to local storage | |
FileOutputStream fos = new FileOutputStream(Main.DATA_PATH + "WMFToPNG_out.png"); | |
fos.write(updatedImage); | |
fos.close(); | |
} catch (Exception e) { | |
System.out.println(e.getMessage()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment