The clickable area of the hyperlink does not surround the image.

\href{https://github.com/}{\includegraphics[height=12pt]{img/github.png}}


Produces:

Desired behavior:

I can achieve something similar by writing some text afterwards...

\href{https://github.com/}{\includegraphics[height=12pt]{img/github.png} github}


EDIT: Looks like it's a problem with xelatex. Cannot reproduce on pdflatex. Version info:

XeTeX  3.14159265-2.6-0.99998 (TeX Live 2017/Arch Linux)
pdfTeX 3.14159265-2.6-1.40.18 (TeX Live 2017/Arch Linux)

Package: graphicx 2017/06/01 v1.1a Enhanced LaTeX Graphics (DPC,SPQR)
Package: hyperref 2017/03/14 v6.85a Hypertext links for LaTeX

• please (again), provide complete small document, which reproduce showed image. your code snippet, as you can see from my answer, works well with xelatex! – Zarko Feb 20 '18 at 8:25
• @Zarko I used your example to test. Running xelatex experiment.tex produces this PDF. – Mateen Ulhaq Feb 20 '18 at 8:28
• apparently your test is not equal to mine. try with example image, then see if your latex installation is up-to -date. as you can see, my result are as you like to have. – Zarko Feb 20 '18 at 8:35
• I tried using the image you posted, but same result. I've edited in some versioning info above. – Mateen Ulhaq Feb 20 '18 at 8:46
• recent hypperef is 2018/02/06 v6.86b. i use miktex, recent version with recent version of all packages. – Zarko Feb 20 '18 at 9:16

you have error in \includegraphics[height=12]{example-image-a} (observe missing units for height of image). for this you should received warnings: Illegal unit of measure ... . correct code is:

\documentclass{article}
\usepackage{graphicx}
\usepackage{hyperref}

\begin{document}
\href{https://github.com/}{\includegraphics[height=12pt]{example-image-a}}
\end{document}


which gives:

tested with pdflatex as well with xelatex. results are the same.

• Sorry that was just a reproduction mistake. I did indeed use 12pt. – Mateen Ulhaq Feb 20 '18 at 7:55
• than you shouldn't have any problems to obtain shoved result. if not, than you have something in your document, what you not show us. on such way is not possible to help you. – Zarko Feb 20 '18 at 7:59
• Looks like it's a problem with xelatex. pdflatex works fine. – Mateen Ulhaq Feb 20 '18 at 7:59
• even worse. how should i know this? i haven't telepathic ability :-(. anyway, see edited answer. i test with xelatex too and it works. – Zarko Feb 20 '18 at 8:00