Last active
March 31, 2021 01:24
-
-
Save symisc/b0c1ad7fdc8a5d9b2b7693b3cd82b97e to your computer and use it in GitHub Desktop.
Convert a given image to the grayscale color space using the PixLab API - https://pixlab.io/cmd?id=grayscale
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* PixLab PHP Client which is just a single class PHP file without any dependency that you can get from Github | |
* https://github.com/symisc/pixlab-php | |
*/ | |
require_once "pixlab.php"; | |
/* | |
* Convert a given image to gray color model. A grayscale (or graylevel) image is simply one in which the only colors are shades of gray. | |
* https://pixlab.io/cmd?id=grayscale for additional information. | |
*/ | |
# Your PixLab key | |
$key = 'PIXLAB_API_KEY'; # Your PixLab API Key - Get your from https://pixlab.io/dashboard | |
$pix = new Pixlab($key); | |
if( !$pix->get('grayscale',array('img' => 'https://www.allaboutbirds.org/guide/PHOTO/LARGE/blue_jay_8.jpg')) ){ | |
echo $pix->get_error_message(); | |
die; | |
} | |
echo "Pic Link: ".$pix->json->link."\n"; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment