Pepeluis
Pepeluis

Reputation: 941

Change web images to black and white

I'm using a API to get some photos from a famous web. And I want to take that pictures and change them to black&white, to re-display in my web but with the colors changed. Is there any possibility to do it without having to store the images on the disk?

THanks. Sorry for my English.

Upvotes: 0

Views: 181

Answers (2)

bensiu
bensiu

Reputation: 25564

example from https://www.php.net/manual/en/function.imagefilter.php

<?php
$im = imagecreatefrompng('yourfile.png');

if($im && imagefilter($im, IMG_FILTER_GRAYSCALE ))
{
    echo 'Image brightness changed.';

    imagepng($im, 'sean.png');
    imagedestroy($im);
}
else
{
    echo 'Image brightness change failed.';
}
?>

Upvotes: 1

Alnitak
Alnitak

Reputation: 339816

Sure, it's possible, but don't do it, it'll almost certainly be a breach of the terms of use of that site.

Upvotes: 0

Related Questions