Getting Started

​ ​Welcome

Blitline Job

Job Response

Job Options

Functions

Polling and Postbacks

Gotchas

Development Recommendations

Service Limits

Examples List

List of Available Functions

Output Options

S3 Destination

IAM Users

S3 Signed Url

Azure Destination

FTP Destination

Other Service Signed Urls

CDN

Advanced

Metadata

Colorspace

Color Extraction

Static IPs

Signed Jobs

Formats

Pipelines

Image Optimization

Smart Image

PDF

Fonts

Subimage

Special (Non-Image) Processing

AWS Rekognition/Facial Recognition

Apache Tika

Vector Processing

Animated GIFs

Screenshots of Websites

IM Scripts

Video Keyframes

Zipping

​ ​Trancoding Video Presets

​ ​Video Transcoding

Color Extraction

Updated a month ago ​by Blitline Support

Color Extraction

You can have Blitline extract the most popular colors from your image. This functionality looks at the histogram of your image and identifies the top “X” colors from the image.



To do this, you must add

“extract_colors”: { “max_colors”: 8 }

To your base JSON, Blitline will analyze and return the color information in the postback/polling JSON. You can find a working example here: http://www.blitline.com/docs/gist_runner?gist_id=ef6e757f5877d006d222


The output will be in the original_metadata tag and look like:

{
    "original_meta": {
        "extracted_colors": {
            "data": [
                {
                    "percentage": "26.29",
                    "pixel_count": 826988,
                    "color": {
                        "r": 182,
                        "g": 192,
                        "b": 177,
                        "hex_color": "#b6c0b1"
                    }
                },
                {
                    "percentage": "21.55",
                    "pixel_count": 677955,
                    "color": {
                        "r": 95,
                        "g": 143,
                        "b": 166,
                        "hex_color": "#5f8fa6"
                    }
                },
                {
                    "percentage": "19.98",
                    "pixel_count": 628627,
                    "color": {
                        "r": 16,
                        "g": 97,
                        "b": 150,
                        "hex_color": "#106196"
                    }
                },
                {
                    "percentage": "17.4",
                    "pixel_count": 547344,
                    "color": {
                        "r": 9,
                        "g": 8,
                        "b": 13,
                        "hex_color": "#09080d"
                    }
                },
                {
                    "percentage": "6.71",
                    "pixel_count": 211046,
                    "color": {
                        "r": 48,
                        "g": 97,
                        "b": 138,
                        "hex_color": "#30618a"
                    }
                },
                {
                    "percentage": "5.2",
                    "pixel_count": 163651,
                    "color": {
                        "r": 177,
                        "g": 154,
                        "b": 105,
                        "hex_color": "#b19a69"
                    }
                },
                {
                    "percentage": "2.84",
                    "pixel_count": 89183,
                    "color": {
                        "r": 61,
                        "g": 93,
                        "b": 109,
                        "hex_color": "#3d5d6d"
                    }
                },
                {
                    "percentage": "0.03",
                    "pixel_count": 934,
                    "color": {
                        "r": 0,
                        "g": 0,
                        "b": 0,
                        "hex_color": "#000000"
                    }
                }
            ],
            "best_guess_background": "#106196"
        },
        "width": 1536,
        "height": 2048,
        "date_created": "2014:08:02 20:17:55",
        "iso_date_created": "2014-08-02T20:17:55.0000+00:00"
    }
}

How did we do?