Gif Problem for facebook
Hello guys. I have problem on facebook. When i sharing gif image which is resized in ImageSharp image doesnt loop and stopping.
example: https://developers.facebook.com/tools/debug/sharing/?q=https%3A%2F%2Fcloud.githubusercontent.com%2Fassets%2F1840003%2F21365920%2F1c479680-c6bd-11e6-80e7-ad4016976a7f.gif
Odd... I'll double check the loop property logic later. Is it just on Facebook, if so could they be altering the displayed image?
can you give me some info where can i find this loop logic? I will fix it. Is it problem of GifEncoding? this problem has only Facebook. I must publish project tomorrow and can't publish because of this problem. Please help me
I am guessing that Facebook is changing the image. When you view the image it looks okay: https://cloud.githubusercontent.com/assets/1840003%2F21365920%2F1c479680-c6bd-11e6-80e7-ad4016976a7f.gif. I don't have Facebook so I cannot check what is going on there.
you can check without facebook account with this tool: https://developers.facebook.com/tools/debug/sharing/ I tested with original .gif and it's working on facebook.
Facebook is telling me to login but I don't have an account so I can't check that page. Is this your output image: https://cloud.githubusercontent.com/assets/1840003%2F21365920%2F1c479680-c6bd-11e6-80e7-ad4016976a7f.gif? It looks okay to me.
I will explain problem: I'm adding watermark on the gif file. after i'm sharing this file on facebook. Gif starting without problem but doesn't looping,
Your problem is clear but I have no idea how you end up with the output file. First you tell us that you resize the image an now you suddenly add a watermark. Can you share a small code sample that we can use to reproduce the issue?
Also i tried save gif without add watermark but same problem Sure:
using (FileStream watermarkstream = System.IO.File.OpenRead(Path.Combine(_env.ContentRootPath, "Resources", "watermark.png")))
using (var fileStream = new FileStream(Path.Combine(_env.WebRootPath, "9b89a6cb-69ac-444f-b458-8a66c0c899fe.gif"), FileMode.Open, FileAccess.ReadWrite))
using (FileStream output = System.IO.File.OpenWrite(Path.Combine(_env.WebRootPath, "New", "9b89a6cb-69ac-444f-b458-8a66c0c899fe.gif")))
{
ImageSharp.Image watermark = new ImageSharp.Image(watermarkstream);
ImageSharp.Image img = new ImageSharp.Image(fileStream);
int waterMarkWidth = img.Width / 6;
var waterMarkHeight = waterMarkWidth * watermark.Height / watermark.Width;
var waterMarkPosition = ImageHelper.WatermarkPosition(img.Width, img.Height, waterMarkWidth, waterMarkHeight);
img.DrawImage(watermark, 70, new Size(waterMarkWidth, waterMarkHeight), waterMarkPosition);
img.Save(output, new GifEncoder() { Quantizer = new PaletteQuantizer<Color>() });
}
Thanks for the code sample.
If the problem only exists on Facebook then I suspect Facebook is changing the file. I would do a compare between the file saved and the file rendered. I suspect they purposely alter the loop count to reduce animation in Facebook posts.
Thank you I think so facebook changing the file, but why original .gif file working?
but why original .gif file working
I'm sorry, I don't understand.
Closing as this is not an issue with ImageSharp.
Facebook seems to be manipulating the file before rendering.