Blog

Get And Process Social Media Profile Pictures

Get And Process Social Media Profile Pictures

If you’re dealing with users’ social media accounts and are in the need of their profile pictures, we’ve got great news for you. With our enhanced Fetch Endpoint you can now retrieve avatar images from Twitter, Facebook, Instagram, GitHub, and Gravatar platforms.

To use this new feature simply modify image url passed to the Optidash API as a part of Image Fetch request. The pattern used for social media profile pictures is platform:user. For example, to fetch GitHub profile picture of user mitchellh provide github:mitchellh as url in the fetch parameters.

Avatars can be easily transformed with the vast array of operations the Optidash API offers. Say you would like to get GitHub profile picture of TJ Holowaychuk (username tj), resize that image to a maximum of 200px and give it a light sepia treatment. A cURL request would look like this:

curl https://api.optidash.ai/1.0/fetch -X POST -u your-api-key: \
-H "Content-Type: application/json" \
-d '{
    "url": "github:tj",
    "resize": {
        "width": 200
    },
    "filter": {
        "sepia": {
            "value": 20
        }
    }
}'

Now let’s try the same set of transformations on Sharika’s Instagram profile picture. This time we will use instagram:shakira as URL for the Fetch endpoint. With our official Node integration, the request would look like this:

const Optidash = require("optidash");

/**
* Instantiate `opti`
*/

const opti = new Optidash("your-api-key");

/**
* Fetch Shakira's Instagram profile picture,
* resize it to 200px, and apply mild Sepia effect
*/

opti
    .fetch("instagram:shakira")
    .resize({
        width: 200
    })
    .filter({
        sepia: {
            value: 20
        }
    })
    .toJSON((err, meta) => {
        if (err) {
            return console.log(err);
        }

        console.log(meta);
    });

As previously stated, we support all major social media outlets. However, it’s worth keeping in mind that due to privacy concerns, Facebook only supports accessing user’s profile pictures by user IDs (and not their full display names). For the full reference, please check out updated API docs for Social Media Profile Pictures.

Should you have questions about fetching social media profile pictures or requests for other features do not hesitate to contact us anytime.

Ready to try Optidash?

Start optimizing your images smarter. Integrate in minutes.

Create Free Account Get In Touch

This website uses cookiesBy using Optidash, you agree to our Cookie Policy.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.