-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gif animation #12
Comments
I' m totally agree with you but application requirements demand to |
Sorry, I would help but this is a very complicated task, even Photoshop doesn't support animated GIF as a layer. I need to change the whole mechanism that GDEnhancer work. |
Thank you for help. Have you some solution to optimize code? |
So your watermark is animated GIF, how about your background image? Is it PNG only or perhaps another animated GIF? |
i take a transparent animated gif file and i want to add a png file as a In my code i split gif into separate frame and i water mark the png file by But this operation demand a lot of ressource. Tell me if you want to take a 2014-03-19 15:15 GMT+02:00 Xianghan Wang notifications@github.com:
|
Sure, you can paste your code here, or send me through email if you wanna keep the code private. my email: coldume[at]gmail[dot]com |
No problem i paste my code here : open($imagebg) ->resize(new Box(600, 600)) ->save('assets/'.$id.'/try/bg.png'); //extract gif & rezize layers $i = 0; foreach ($imagine->open($gif)->layers() as $layer) { $layer->resize(new Box(450, 450))->save("assets/".$id."/try/frame-$i.png"); $i++; } //*************************** header('Content-Type: image/png'); // Create the image $im = imagecreatefrompng('assets/'.$id.'/try/bg.png'); // Create some colors $white = imagecolorallocate($im, 255, 255, 255); $grey = imagecolorallocate($im, 128, 128, 128); $black = imagecolorallocate($im, 0, 0, 0); //imagefilledrectangle($im, 0, 0, 399, 29, $grey); // The text to draw //$text = 'Testing...'; // Replace path by your own font path $font = 'php/oneway.ttf'; // Add some shadow to the text imagettftext($im, 60, 0, 600, 800, $white, $font, $text); // Add the text imagettftext($im, 45, 0, 150,550, $white, $font, $text); // Using imagepng() results in clearer text compared with imagejpeg() imagepng($im,'assets/'.$id.'/try/bg.png'); imagedestroy($im); //************************** //past gif file on background use gdenhancer\GDEnhancer; include_once 'php/gdenhancer/GDEnhancer.php'; for ($c =0; $c < $i; $c++) { $imagee=null; $save=null; $imagee = new GDEnhancer("assets/".$id."/try/bg.png"); $imagee->layerImage("assets/".$id."/try/frame-$c.png"); $imagee->layerMove(0,'topcenter',0,0); $save = $imagee->save(); header('content-type:'.$save['mime'] ); $filename = "assets/".$id."/try/frame-$c.png"; file_put_contents($filename, $save['contents']); imagedestroy($imagee); } //implde a gif file $image = $imagine->open("assets/".$id."/try/frame-0.png"); $layers = $image->layers(); for ($c = 1; $c < $i; $c++) { $layers[] = $imagine->open("assets/".$id."/try/frame-$c.png"); } $name = date("Y-m-d_H-i-s").'.gif'; $image->save("assets/".$id."/try/".$name, array( 'animated' => true, 'animated.delay' => 150, // delay in ms 'animated.loops' => 0, // number of loops, 0 means infinite )); imagedestroy($image); for ($c = 0; $c < $i; $c++) { unlink("assets/".$id."/try/frame-$c.png"); } unlink("assets/".$id."/try/bg.png"); echo '' ;/\* / */ ?>2014-03-19 16:03 GMT+02:00 Xianghan Wang notifications@github.com:
|
May I know what is the size(in KB) of the original PNG image and the size of output GIF? |
In javascript, user can't upload file up than 2 mo. 2014-03-19 16:41 GMT+02:00 Xianghan Wang notifications@github.com:
|
I mean, dose your code run successfully? What is the image size of the test image and output image? |
if i run this code with recommended image size it take one minute to 2014-03-19 16:59 GMT+02:00 Xianghan Wang notifications@github.com:
|
that's why i try to optimize my code to generate the gif file in a short 2014-03-19 17:03 GMT+02:00 walid Jlidi walid.jlidi89@gmail.com:
|
So your code is working, can you link original image and the output image? |
can you please explain more ? 2014-03-19 17:07 GMT+02:00 Xianghan Wang notifications@github.com:
|
I have never use imagine before, so I can't help too much. Try to insert microtime(true); on different location of your code. And find what part of your code takes more time to run. Let me know if you find it. :) |
Ok i will do this. 2014-03-19 17:34 GMT+02:00 Xianghan Wang notifications@github.com:
|
Is it possible to background fill of an animated gif file with a png file usign this library (Use GIF as watermark image.). If is possible can you precise which function i have to use?
the result will be like this http://www.css-101.org/articles/two-layer-image/animated-gif-with-a-jpg-background.php
The text was updated successfully, but these errors were encountered: