Re: Cropping images with fading outline effects, using GD, etc.?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sorry, but, I'm the wrong person to look for an example...<smile>

My guess would be that, for example, would like to, take a normal photo image of someone's upper body, and maybe cut out primarily their face, and then do something like if the radius of the complete outline picture would be like 100 pixels, then have the outer rim of esomewhere between 5-10 pixels sort of fade in from transparent to normal/standard opacity, or thereabouts, but, the person who'd uploaded it might want to be able to make some choices about sort of fade in/transition effect/detail as well..?

Thanks

Jacob Kruger
Blind Biker
Skype: BlindZA
'...fate had broken his body, but not his spirit...'

----- Original Message ----- From: "Pierre Joye" <pierre.php@xxxxxxxxx>
To: "Jacob Kruger" <jacob@xxxxxxxxxxxxx>
Cc: "php-windows" <php-windows@xxxxxxxxxxxxx>
Sent: Wednesday, August 07, 2013 10:08 AM
Subject: Re: Cropping images with fading outline effects, using GD, etc.?


hi!

Can you post a link to an image showing what you like to achieve? With
the src image?

Thanks!

On Wed, Aug 7, 2013 at 9:46 AM, Jacob Kruger <jacob@xxxxxxxxxxxxx> wrote:
I need/want to be able to take either uploaded, or stored image files, and crop them into either rectangular, or elliptical pieces/shapes, and am using GD library thus far.

The basics are not an issue - for rectangular cropping, imagecopy and imagecopyresize, etc. are functions that can handle it easily enough, and in terms of elliptical cropping, I am drawing an elliptical shape onto the original image using a colour that's unlikely to be part of the original image resource, with drawing line thickness set to 2 pixels for now, and then I do a form of flood fill to border with that same colour outside the ellipsis, and then set that as the transparent colour of the image, before copying the relevant part to another image resource as well.

However, it now comes down to that the images to be saved might also need to have sort of faded/increasingly transparent outlines, and these would generally be photo's, and so, just choosing a single transparent colour won't really work too well.

Was thinking simplest will be to in fact take multiple instances of each image, with each of them going slightly smaller in terms of width/height, and then I could keep them centred on each other, but sort of overlay them with the most transparent/faded/widest image instance starting from back, and with sort of original colouration/narrowest one being applied to output resource last, and this should implement a form of faded/blurred outline/edging to output image?

However, it again comes down to trying to decide on best/simplest way to apply a form of global transparency filter to an image resource, without needing to specify a specific colour each time for something like the imagecolourtransparent function, since suppose would need to then figure out a way to determine which RGB value would work best per image - and don't think that could be made to work consistently either.

In other words, what am really looking for at moment is a way to set the opacity of an image resource - and if it comes down to capturing the output buffer while using something like imagepng to stream the image resource to the buffer, that's not an issue either since am already using a form of that to sometimes capture image resource data in another way, but, would need to find a way to somehow affect opacity of output stream image then as well.

While I am currently pretty much just using GD library, I would be open to other suggestions/workarounds/thoughts on the simplest way to implement something like this?

And, if I'm just missing, or haven't come across a simple way to implement faded/graded outlines for images, would also like to know that...<smile>

TIA

Jacob Kruger
Blind Biker
Skype: BlindZA
'...fate had broken his body, but not his spirit...'



--
Pierre

@pierrejoye | http://blog.thepimp.net | http://www.libgd.org


--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux