Create bitmap from scratch or load from file using Java
Contents
[
Hide
]
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:
- Create an instance of the
Bitmap
class. - Initialize an object of the
Graphics
class from this bitmap. - Define a
Pen
object with the desired parameters. - Utilize the
drawArc()
method of theGraphics
class object to draw an Arc.
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: