Created
January 31, 2024 09:04
-
-
Save conholdate-gists/d643225c34c65837144095d5145b028c to your computer and use it in GitHub Desktop.
Crop Image Online for Free - Crop Image in C# or 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
// Load an image using the RasterImage class | |
Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)Aspose.Imaging.Image.Load("aspose_logo.jpg"); | |
// Cache the image for better performance | |
if (!rasterImage.IsCached) | |
{ | |
rasterImage.CacheData(); | |
} | |
// Set the coordinates with the Rectangle class | |
Aspose.Imaging.Rectangle rectangle = new Aspose.Imaging.Rectangle(35, 35, 580, 240); | |
// Crop the image | |
rasterImage.Crop(rectangle); | |
// Save the cropped image | |
rasterImage.Save("Crop-Image.jpg"); |
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
// Load an image using the RasterImage class | |
com.aspose.imaging.RasterImage rasterImage = (com.aspose.imaging.RasterImage)com.aspose.imaging.Image.load("aspose_logo.jpg"); | |
// Cache the image for better performance | |
if (!rasterImage.isCached()) | |
{ | |
rasterImage.cacheData(); | |
} | |
// Set the coordinates with the Rectangle class | |
com.aspose.imaging.Rectangle rectangle = new com.aspose.imaging.Rectangle(35, 35, 580, 240); | |
// Crop the image | |
rasterImage.crop(rectangle); | |
// Save the cropped image | |
rasterImage.save("Crop-Image.jpg"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment