Re: Cropping images with fading outline effects, using GD, etc.?
| From: | Pierre Joye | Date: | Wed, 07 Aug 2013 08:08:18 +0000 |
| Subject: | Re: Cropping images with fading outline effects, using GD, etc.? | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-31097@lists.php.net to get a copy of this message | ||
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@blindza.co.za> 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