Yes, it is allowed. This is a typical flavor changing neutral process. In the Standard Model, this kind of process is highly suppressed, because the neutral bosons ($\gamma$, $Z$) always couple to quarks of the same flavor at tree-level. So, a vertex connecting two quarks of different flavors with a neutral gauge boson only appears at higher orders in perturbation theory.
For the process $B\to K \gamma$, there are two types of diagrams that may contribute: (i) box diagrams and (ii) penguin diagrams. The first type of diagram is already drawn in you question and you just have to be careful if you are considering $K^0$ or $\bar{K}^0$ in the final state, since this diagram changes flavor two times ($\Delta F =2$).
The second type of diagram is given by
$\hskip{5cm}$ 
where the second quark is just a spectator and the $W$ boson and the $t$ quark are running in the loop. So, in this case you change flavor only 1 time ($\Delta F =1$). There are other diagrams similar to this one that are also called "penguin diagrams", because you can also exchange $W$ and $t$, or draw a self-energy like diagram.
Now, how do we compute this kind of diagram? Usually, we write an effective Hamiltonian with all allowed dimension 6 operators multiplying Wilson Coefficients. Then, we compute theses diagrams in the full theory (with propagating $W$ bosons) and we make the matching of the effective theory with the full theory, extracting the values of the Wilson coefficients. You can find more details in the review of Buras, for example.