How to Add Shortcode to html img code?

You cannot use Shortcodes in attributes since 4.2.3, for security reasons. See the announcement (emphasis mine):

Earlier today, we released WordPress 4.2.3, which includes a
relatively large security fix that affects the Shortcode API. Due to
the nature of the fix – as is often the case with security fixes – we
were unable to alert plugin authors ahead of time, however we did make
efforts to scan the plugin directory for plugins that may have been

With this change, every effort has been made to preserve all of the
core features of the Shortcode API. That said, there are some new
limitations that affect some rare uses of shortcodes.

In today’s release of WordPress 4.2.3, however, we’ve added some new
limitations that affect some existing plugins. Take, for example, the
following shortcode, which is no longer recognized:

<div style="background-image: url('[shortcode]');">

The shortcode in the example above appears in a context that is no
longer supported. Further, this use of a shortcode stretches the
imagination for how the Shortcode API was intended to be used.

Fortunately, there are some workarounds still available, so that site
administrators are not overly restricted in their use of HTML.

Read the full announcement for the workarounds.