def render_image_iterm2
      return nil unless valid?

      # References:
      # https://iterm2.com/documentation-images.html
      # https://iterm2.com/utilities/imgcat

      # tmux requires some extra work for unrecognised escape code sequences
      screen = ENV['TERM'].start_with? 'screen'
      prefix = screen ? "\ePtmux;\e\e]" : "\e]"
      suffix = screen ? "\a\e\\" : "\a"

      png = qrcode.as_png(size: 600)
      png_base64 = Base64.encode64(png.to_s).chomp
      options = 'inline=1'
      "#{prefix}1337;File=#{options}:#{png_base64}#{suffix}"
    end
def render_image_iterm2
      return nil unless valid?

      # References:
      # https://iterm2.com/documentation-images.html
      # https://iterm2.com/utilities/imgcat

      # tmux requires some extra work for unrecognised escape code sequences
      screen = ENV['TERM'].start_with? 'screen'
      prefix = screen ? "\ePtmux;\e\e]" : "\e]"
      suffix = screen ? "\a\e\\" : "\a"

      png = qrcode.as_png(size: 600)
      png_base64 = Base64.encode64(png.to_s).chomp
      options = 'inline=1'
      "#{prefix}1337;File=#{options}:#{png_base64}#{suffix}"
    end
Render the QR code as an inline image for iTerm2.
 Returns a string.