SkillAgentSearch skills...

RandomImageGenerator

Random image generator library for Android

Install / Use

/learn @stedi-akk/RandomImageGenerator
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

RIG – Random Image Generator

A library for Android that generates random Bitmap images. Generation is performed on the basis of different passed parameters like width, height, type of generator, color palette, etc. Images can be also automatically saved in the requested path with appropriate quality.

<img src="https://github.com/stedi-akk/RandomImageGenerator/raw/master/images/2.png" width="128"> <img src="https://github.com/stedi-akk/RandomImageGenerator/raw/master/images/1.png" width="128"> <img src="https://github.com/stedi-akk/RandomImageGenerator/raw/master/images/4.png" width="128"> <img src="https://github.com/stedi-akk/RandomImageGenerator/raw/master/images/9.png" width="128"> <img src="https://github.com/stedi-akk/RandomImageGenerator/raw/master/images/5.png" width="128"> <img src="https://github.com/stedi-akk/RandomImageGenerator/raw/master/images/6.png" width="128"> <img src="https://github.com/stedi-akk/RandomImageGenerator/raw/master/images/11.png" width="128"> <img src="https://github.com/stedi-akk/RandomImageGenerator/raw/master/images/8.png" width="128"> <img src="https://github.com/stedi-akk/RandomImageGenerator/raw/master/images/3.png" width="128"> <img src="https://github.com/stedi-akk/RandomImageGenerator/raw/master/images/10.png" width="128"> <img src="https://github.com/stedi-akk/RandomImageGenerator/raw/master/images/7.png" width="128"> <img src="https://github.com/stedi-akk/RandomImageGenerator/raw/master/images/12.png" width="128">

Usage

Simple example with callback:

new Rig.Builder()
        .setGenerator(generator)
        .setFixedSize(1920, 1080) // can be also 1x1, 1x1000, etc
        .setCount(10)
        .setCallback(new GenerateCallback() {
            @Override
            public void onGenerated(ImageParams imageParams, Bitmap bitmap) {
                // will be called 10 times with a new bitmap 1920x1080 on every call
            }
            @Override
            public void onFailedToGenerate(ImageParams imageParams, Exception e) {
                // in case if generation failed
            }
        })
        .build()
        .generate();

Simple example with compression:

new Rig.Builder()
        .setGenerator(generator)
        .setFixedSize(1920, 1080) // can be also 666x666, 1337x1337, etc
        .setQuality(Quality.jpg(90))
        .setFileSavePath(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).getPath())
        .setFileSaveCallback(new SaveCallback() {
            @Override
            public void onSaved(Bitmap bitmap, File file) {
                // will be called when bitmap is saved
            }
            @Override
            public void onFailedToSave(Bitmap bitmap, Exception e) {
                // in case if compression failed
            }
        })
        .build()
        .generate();

For more information, please see Rig.Builder javadoc.

Embed generators

There are currently 6 generators, and 3 effects.

<img src="https://github.com/stedi-akk/RandomImageGenerator/raw/master/images/FlatColorGenerator/1.png" height="128"> <img src="https://github.com/stedi-akk/RandomImageGenerator/raw/master/images/FlatColorGenerator/2.png" height="128"> <img src="https://github.com/stedi-akk/RandomImageGenerator/raw/master/images/FlatColorGenerator/3.png" height="128">

<img src="https://github.com/stedi-akk/RandomImageGenerator/raw/master/images/ColoredPixelsGenerator/1.png" height="128"> <img src="https://github.com/stedi-akk/RandomImageGenerator/raw/master/images/ColoredPixelsGenerator/2.png" height="128"> <img src="https://github.com/stedi-akk/RandomImageGenerator/raw/master/images/ColoredPixelsGenerator/3.png" height="128">

<img src="https://github.com/stedi-akk/RandomImageGenerator/raw/master/images/ColoredRectangleGenerator/1.png" height="128"> <img src="https://github.com/stedi-akk/RandomImageGenerator/raw/master/images/ColoredRectangleGenerator/2.png" height="128"> <img src="https://github.com/stedi-akk/RandomImageGenerator/raw/master/images/ColoredRectangleGenerator/3.png" height="128">

<img src="https://github.com/stedi-akk/RandomImageGenerator/raw/master/images/ColoredNoiseGenerator/1.png" height="128"> <img src="https://github.com/stedi-akk/RandomImageGenerator/raw/master/images/ColoredNoiseGenerator/2.png" height="128"> <img src="https://github.com/stedi-akk/RandomImageGenerator/raw/master/images/ColoredNoiseGenerator/3.png" height="128">

<img src="https://github.com/stedi-akk/RandomImageGenerator/raw/master/images/ColoredCirclesGenerator/1.png" height="128"> <img src="https://github.com/stedi-akk/RandomImageGenerator/raw/master/images/ColoredCirclesGenerator/2.png" height="128"> <img src="https://github.com/stedi-akk/RandomImageGenerator/raw/master/images/ColoredCirclesGenerator/3.png" height="128">

<img src="https://github.com/stedi-akk/RandomImageGenerator/raw/master/images/ColoredLinesGenerator/1.png" height="128"> <img src="https://github.com/stedi-akk/RandomImageGenerator/raw/master/images/ColoredLinesGenerator/2.png" height="128"> <img src="https://github.com/stedi-akk/RandomImageGenerator/raw/master/images/ColoredLinesGenerator/3.png" height="128">

<img src="https://github.com/stedi-akk/RandomImageGenerator/raw/master/images/MirroredEffect/1.png" height="128"> <img src="https://github.com/stedi-akk/RandomImageGenerator/raw/master/images/MirroredEffect/2.png" height="128"> <img src="https://github.com/stedi-akk/RandomImageGenerator/raw/master/images/MirroredEffect/3.png" height="128">

<img src="https://github.com/stedi-akk/RandomImageGenerator/raw/master/images/ThresholdEffect/1.png" height="128"> <img src="https://github.com/stedi-akk/RandomImageGenerator/raw/master/images/ThresholdEffect/2.png" height="128"> <img src="https://github.com/stedi-akk/RandomImageGenerator/raw/master/images/ThresholdEffect/3.png" height="128">

<img src="https://github.com/stedi-akk/RandomImageGenerator/raw/master/images/TextOverlayEffect/1.png" height="128"> <img src="https://github.com/stedi-akk/RandomImageGenerator/raw/master/images/TextOverlayEffect/2.png" height="128"> <img src="https://github.com/stedi-akk/RandomImageGenerator/raw/master/images/TextOverlayEffect/3.png" height="128">

Custom generators

To create your own generator, you just need to implement Generator interface:

public class MyGenerator implements Generator {
    @Override
    public Bitmap generate(ImageParams imageParams) throws Exception {
        // your generation here
    }
}

Color palette

By default, the library generates images with all available HSV colors. RigPalette class is used to change this palette.

Examples:

RigPalette.blackAndWhite()

<img src="https://github.com/stedi-akk/RandomImageGenerator/raw/master/images/Grayscale/1.png" height="128"> <img src="https://github.com/stedi-akk/RandomImageGenerator/raw/master/images/Grayscale/2.png" height="128"> <img src="https://github.com/stedi-akk/RandomImageGenerator/raw/master/images/Grayscale/3.png" height="128">

RigPalette.fromColor(Color.RED)

<img src="https://github.com/stedi-akk/RandomImageGenerator/raw/master/images/Red/1.png" height="128"> <img src="https://github.com/stedi-akk/RandomImageGenerator/raw/master/images/Red/2.png" height="128"> <img src="https://github.com/stedi-akk/RandomImageGenerator/raw/master/images/Red/3.png" height="128">

RigPalette.fromColor(Color.GREEN)

<img src="https://github.com/stedi-akk/RandomImageGenerator/raw/master/images/Green/1.png" height="128"> <img src="https://github.com/stedi-akk/RandomImageGenerator/raw/master/images/Green/2.png" height="128"> <img src="https://github.com/stedi-akk/RandomImageGenerator/raw/master/images/Green/3.png" height="128">

RigPalette.fromColor(Color.BLUE)

<img src="https://github.com/stedi-akk/RandomImageGenerato

Related Skills

View on GitHub
GitHub Stars9
CategoryContent
Updated1y ago
Forks4

Languages

Java

Security Score

75/100

Audited on Aug 17, 2024

No findings