Skip to content
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

Animated GIF bugged colors #36

Closed
Kekke88 opened this issue Feb 27, 2014 · 12 comments
Closed

Animated GIF bugged colors #36

Kekke88 opened this issue Feb 27, 2014 · 12 comments

Comments

@Kekke88
Copy link

Kekke88 commented Feb 27, 2014

Hello, I've been trying to add an image upon a GIF image using your libraries.

However, it turns the gif image into some weird blue color.
I have tried to debug but I can't find what's wrong, I tried using getResult with a background color but it still didn't help.

I printed the frames as images and it seems that image #2 is the first image to get weird colors.

Here is the picture before:
http://i.imgur.com/M3bM7yP.gif

and after:
http://i.imgur.com/lyMu2P0.gif

All the images extracted:
http://imgur.com/2kFqUzw,TAxAjeC,YzM4ztE,alotpAS,CdUTa7a,IQQiylp,BjI14CD,IlrQZiC,mo2vrs1,QPEsR67,ohFZ4sN,xM9jzvC,GyA3Toa,Eepmqhv,O5vxpfc,IE1lKG9,EqP9foq,VAtE7oY,sVsteMd,NtQziAE,YVKMGfz,4GEgyBf,3cvPE7m,hgJtWCt,dbbQSNe,mrBjnRN,MgAbBqi,1i3yhLn,43GUKOu,hkmXP0n,ysajT72#1

Regards

@GoodLittleDev
Copy link

so what exactly does your code look like??

On Thu, Feb 27, 2014 at 6:58 AM, Kekke88 notifications@github.com wrote:

Hello, I've been trying to add an image upon a GIF image using your
libraries.

However, it turns the gif image into some weird blue color.
I have tried to debug but I can't find what's wrong, I tried using
getResult with a background color but it still didn't help.

I printed the frames as images and it seems that image #2https://github.com/Sybio/ImageWorkshop/pull/2is the first image to get weird colors.

Here is the picture before:
http://i.imgur.com/M3bM7yP.gif

and after:
http://i.imgur.com/lyMu2P0.gif

Regards

Reply to this email directly or view it on GitHubhttps://github.com//issues/36
.

@GoodLittleDev
Copy link

please also attach the images as pieces so we can try to duplicate your error. thank you.

@Kekke88
Copy link
Author

Kekke88 commented Mar 4, 2014

[code]

extract($gifPath); ``` $watermarkLayer = ImageWorkshop::initFromPath('wm.png'); $retouchedFrames = array(); //$it = 0; foreach ($frames as $frame) { $frameLayer = ImageWorkshop::initFromResourceVar($frame['image']); $frameLayer->resizeInPixel($frameLayer->width, $frameLayer->height, false); $frameLayer->addLayerOnTop($watermarkLayer, 20, 20, 'LB'); $image = $frameLayer->getResult(); // Creating all the GIF Images //imagejpeg($image, 'test' . $it . '.jpg', 95); $retouchedFrames[] = $frameLayer->getResult(); //$it++; } // Then we re-generate the GIF $gc = new GifCreator(); $gc->create($retouchedFrames, $gfe->getFrameDurations(), 0); // And now save it ! file_put_contents('newgif.gif', $gc->getGif()); } ``` ?>

[/code]

Before:
teac

After:
newgif

@Kekke88
Copy link
Author

Kekke88 commented Mar 4, 2014

I've also tried using a color in the getResult as suggested but to no avail.

@GoodLittleDev
Copy link

I think you may need to may a group layer for the addLayerOnTop to work properly. also it looks like you may be working with a true color and non true color images (gif, png) you could try converting the png to a palette with imagetruecolortopalette() function.

@Kekke88
Copy link
Author

Kekke88 commented Mar 6, 2014

As I said in my first post, it doesn't matter if I add the watermark or not, it still gets that blue color.

@GoodLittleDev
Copy link

you could try saving each image after each step to find out when the blue's added. also the resize is pointless, your resizing it to it's current size.

@Kekke88
Copy link
Author

Kekke88 commented Mar 6, 2014

I have tried saving them after each step as I said in my first post, the blue gets added to the second image.

I tried without resize function but the image just becomes a 24kb file that I can't view.

@GoodLittleDev
Copy link

try:

extract($gifPath); // Then we re-generate the GIF $gc = new GifCreator(); $gc->create($frames, $gfe->getFrameDurations(), 0); // And now save it ! file_put_contents('newgif.gif', $gc->getGif()); } ?>

to check that it is the image workshop and not the extractor / gif merge process.

@Kekke88
Copy link
Author

Kekke88 commented Mar 7, 2014

I get the following error from using your code:

Notice: Undefined variable: mode in C:\xampp\htdocs\gifwm\GifCreator.php on line 120

Fatal error: Uncaught exception 'Exception' with message 'GifCreator: Under development: You have to give resource image variables, image URL or image binary sources in $frames array. ()' in C:\xampp\htdocs\gifwm\GifCreator.php:120 Stack trace: #0 C:\xampp\htdocs\gifwm\new.php(52): GifCreator->create(Array, Array, 0) #1 {main} thrown in C:\xampp\htdocs\gifwm\GifCreator.php on line 120

@KasztaN9
Copy link

I have the same problem. Refreshing and ask for help

@jdecool
Copy link
Collaborator

jdecool commented Mar 28, 2015

Hi,

I've just make some test about this issue. The bug is not located in the ImageWorkshop library.

It is a GifFrameExtractor library bug, due to some transformation for extracting each GIF frame (in GifFrameExtractor::extract method in frame loop).

So I close this issue and open a issue in the appropriated repository.

Thanks for your feedback.

@jdecool jdecool closed this as completed Mar 28, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants