Skip to content

Instantly share code, notes, and snippets.

@conholdate-gists
Created May 12, 2025 13:36
Show Gist options
  • Save conholdate-gists/1a84bf2e1ff4f9dce9b8aa30d5702225 to your computer and use it in GitHub Desktop.
Save conholdate-gists/1a84bf2e1ff4f9dce9b8aa30d5702225 to your computer and use it in GitHub Desktop.
Flip Images in Java | Flip Images Horizontally or Vertically
// Load image
com.aspose.imaging.RasterImage image = (com.aspose.imaging.RasterImage) com.aspose.imaging.Image.load("image.png");
// Flip the image horizontally
image.rotateFlip(com.aspose.imaging.RotateFlipType.RotateNoneFlipX);
// Save the flipped image
image.save("flipped-horizontal.png");
// Load image
com.aspose.imaging.RasterImage image = (com.aspose.imaging.RasterImage) com.aspose.imaging.Image.load("image.png");
// Flip the image both horizontally and vertically
image.rotateFlip(com.aspose.imaging.RotateFlipType.RotateNoneFlipXY);
// Save the flipped image
image.save("flipped-both.png");
// Load image
com.aspose.imaging.RasterImage image = (com.aspose.imaging.RasterImage) com.aspose.imaging.Image.load("image.png");
// Flip the image vertically
image.rotateFlip(com.aspose.imaging.RotateFlipType.RotateNoneFlipY);
// Save the vertically flipped image
image.save("flipped-vertical.png");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment