// Get ClientID and ClientSecret from https://dashboard.aspose.cloud/ String clientId = "7ef10407-c1b7-43bd-9603-5ea9c6db83cd"; String clientSecret = "ba7cc4dc0c0478d7b508dd8ffa029845"; // create Imaging object ImagingApi imageApi = new ImagingApi(clientSecret, clientId); // load file from local drive File f = new File("PinClipart.png"); // read the content of PNG image to byte array byte[] bytes = Files.readAllBytes(f.toPath()); // specify the width and height for cropped image int newWidth = 350; int newHeight = 350; // specify the point from which image crop shall start int x = 100; int y = 100; // create crop image request while specifying resultant image name CreateCroppedImageRequest cropRequest = new CreateCroppedImageRequest(bytes, x,y, newWidth, newHeight, null, "Cropped.png", null); // call method to crop PNG and save output in cloud storage imageApi.createCroppedImage(cropRequest);