public async override void Invoke()
            {
                ITextBuffer textBuffer = this.HtmlSmartTag.TextBuffer;
                ElementNode element = this.HtmlSmartTag.Element;
                AttributeNode src = element.GetAttribute("src", true);
                ImageCompressor compressor = new ImageCompressor();

                bool isDataUri = src.Value.StartsWith("data:image/", StringComparison.Ordinal);

                if (isDataUri)
                {
                    string dataUri = await compressor.CompressDataUri(src.Value);

                    if (dataUri.Length < src.Value.Length)
                    {
                        using (EditorExtensionsPackage.UndoContext("Optimize image"))
                        {
                            Span span = Span.FromBounds(src.ValueRangeUnquoted.Start, src.ValueRangeUnquoted.End);
                            textBuffer.Replace(span, dataUri);
                        }
                    }
                }
                else
                {
                    var fileName = ImageQuickInfo.GetFullUrl(src.Value, textBuffer);

                    if (string.IsNullOrEmpty(fileName) || !ImageCompressor.IsFileSupported(fileName) || !File.Exists(fileName))
                        return;

                    await compressor.CompressFiles(fileName);
                }
            }