Create bitmap from scratch or load from file using Java

Whether you’re creating a bitmap from scratch or loading one from an existing file, Aspose.Drawing for Java simplifies these common tasks, providing a seamless experience for bitmap creation and editing.

Create New Bitmap in Java

Creating a new image from scratch is pretty straightforward with the Aspose.Drawing Java API. The ensuing Java code example demonstrates how to create a new bitmap and draw an Arc on it:

  1. Create an instance of the Bitmap class.
  2. Initialize an object of the Graphics class from this bitmap.
  3. Define a Pen object with the desired parameters.
  4. Utilize the drawArc() method of the Graphics class object to draw an Arc.

Draw arc in bitmap in Java

Draw arc graphics on bitmap in Java

Load existing Image from File into Bitmap

Loading an existing image from a file and saving it back to disk using the Java API can be accomplished, as presented in the following Java code sample:

Load and save image bitmap in Java

Load and save image bitmap in Java