mouseywings Posted September 21, 2014 Share Posted September 21, 2014 Here is the code I have right now: <?php header('Content-type: image/png'); $grey = new ImagickPixel('#ebebeb'); $orange = new ImagickPixel('#0f92d6'); $image = new Imagick('assets/lop.png'); $layer = new Imagick('assets/lop-base.png'); $layer->thumbnailImage(200, 0); $image->thumbnailImage(200, 0); $layer->paintOpaqueImage($grey, $orange, 100); // Place layer on image $image->compositeImage($layer, Imagick::COMPOSITE_SOFTLIGHT, 0, 0); // Let's merge all layers (it is not mandatory). $image->flattenImages(); echo $image; ?> It's putting the layers on top of eachother very nice. The thing is is that this involves some heavy shading at times depending on the bunny breeds. Here is what the base image ($image) looks like: And here is what the overlay ($layer) looks like: This is what the outcome looks like versus the intended result: I've tried almost all of their composite constants.. I can't figure out how to do this or the best way of going about it. Because the colors are going to be dynamic throughout the site so I can't just save a .png of every color combination.. and there will be more colors layered on top of eachother like markings/patterns/etc. Thanks for any help! Quote Link to comment https://forums.phpfreaks.com/topic/291208-imagemagick-layer-overlay/ Share on other sites More sharing options...
QuickOldCar Posted September 22, 2014 Share Posted September 22, 2014 (edited) Add $_GET parameters to your url for your script so you can control any colors or shading strengths. As an example I'll show you my website snapshots using parameters and GD instead http://dynaindex.com/url-thumb.php?size=250&text=Dynaindex.com&textsize=8&textcolor=aqua&url=phpfreaks.com Edited September 22, 2014 by QuickOldCar Quote Link to comment https://forums.phpfreaks.com/topic/291208-imagemagick-layer-overlay/#findComment-1491773 Share on other sites More sharing options...
mouseywings Posted September 22, 2014 Author Share Posted September 22, 2014 I don't want the user to be able to control the shading strengths though..? I was using GD as well, but ImageMagick seems to offer so much more control so I switched over to that. Your screenshot is just a screenshot of phpfreaks.. Quote Link to comment https://forums.phpfreaks.com/topic/291208-imagemagick-layer-overlay/#findComment-1491775 Share on other sites More sharing options...
QuickOldCar Posted September 22, 2014 Share Posted September 22, 2014 Because the colors are going to be dynamic throughout the site so I can't just save a .png of every color combination The idea would be to show images using your own script and setting values the way you need them to appear. I was showing how url parameters can manipulate the generated image. So your issue is how to make the bunny colors change without darkening the lighter sections as well? I believe you have to use a grayscale image and -modulate http://www.imagemagick.org/Usage/photos/#chroma_key Look at the shirt image examples You can also look at replace and fuzz To better explain using a single script using GET parameters you would post this image code and change the values wherever needed it. <img src="imagemagick.php?shading=10&color=blue"/> And in your php script making variables for each if(isset($_GET['shading']) && ctype_digit($_GET['shading'])){ $shading = $_GET['shading']; }else( $shading = "0"; } if(isset($_GET['color']) && trim($_GET['color']) !=''){ $color = trim($_GET['color']); }else( $color = "white"; } Quote Link to comment https://forums.phpfreaks.com/topic/291208-imagemagick-layer-overlay/#findComment-1491780 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.