Grainy gif output when using `Graphics` on source Bitmap
I've cobbled together some horrible test code for taking an a gif, writing some text to each frame and saving again, however I'm encountering a rather annoying issue. Read here
If all frames are left as they are then the output gif is comparable to the input gif, however once I start using
Graphics
on the frames then the quality drops noticeably and in a way that makes me think it's using indexed colour however I can't find any explanation as to why this is or how I could go about fixing this.
Anyone worked with GDI+/Graphics know what the hecc is happening here?2 Replies
for not knowing how to read and write, i would mediainfo the two gifs and look at differences
except for the noise they are pretty similar in color depth to me so still there may not be differences there
also if you are not changing size i would try with a less impactful SmoothingMode flag
I hadn't actually thought to check the metadata, unfortunately MediaInfo is showing both the input and output to be identical from a metadata standpoint. Whatever is happening seems to be caused by the use of
Graphics
messing with the bitmap somehow as not calling any graphics g.DrawX
methods results in a 1:1 recreation of the input.
I did also try a lower smoothing mode but it was resulting in some pretty jagged lines, although that may be because my DrawStringOutlined
extension method is using a GraphicsPath
to draw the text and it's outline? I haven't tested much tbh and this is my first time using System.Drawing
stuff