Sample Image Generator
Java library to generate sample images of arbitrary size.
<dependency>
<groupId>com.github.mike10004</groupId>
<artifactId>sample-image-generator</artifactId>
<version>[CHECK MAVEN CENTRAL BADGE ABOVE]</version>
</dependency>
Usage
Need a 10MB jpeg to load-test your image processing application?
NoiseImageGenerator generator = NoiseImageGenerator.createGenerator(ImageFormat.JPEG);
File imageFile = new File("largeimage.jpg");
try (OutputStream out = new FileOutputStream(imageFile)) {
generator.generate(10 * 1024 * 1024, out);
}
Only PNG and JPEG output formats are currently supported.
Changelog
0.4
- fix jpeg write error in Java 11
Credits
Seed image for the default scaling image generator is from publicdomainpictures.net. The author is Jean Beaufort and it is distributed under the CC0 license.