SoFunction
Updated on 2025-03-10

How to add image watermark implementation ideas and code for gif animation


public static Bitmap WaterMarkWithText( origialGif, string
text,string filePath)
{
// Used to store frames
List<Frame> frames = new
List<Frame>();
//If it is not a gif file, return to the original image directly
if (
!= )
{
return origialGif;

}
//If the image is a gif file
foreach (Guid guid in
)
{

frameDimension = new (guid);
int
frameCount = (frameDimension);
for (int i = 0; i
< frameCount; i++)
{
if ((frameDimension,
i) == 0)
{
int delay =
Convert.ToInt32((20736).(i));
Image
img = (());
Font font = new Font(new
FontFamily("Song style"), 35.0f,);
Graphics g =
(img);
(text, font, ,
new PointF(10.0f, 10.0f));
Frame frame = new Frame(img, delay);

(frame);
}
}
gif =
new ();
(filePath);

(100);
(0);
for (int i = 0; i <
; i++)
{
(frames[i].Image);
}

();
try
{
Bitmap gifImg =
(Bitmap)(filePath);
return gifImg;
}
catch
{

return origialGif;
}
}
return origialGif;
}