The study of non-equilibrium dynamics of many-body systems after a quantum quench received a considerable boost and a deep theoretical understanding from the path integral formulation in imaginary time. However, the celebrated problem of a quench in the Luttinger parameter of a one dimensional quantum critical system (massless quench) has so far only been solved in the real-time Heisenberg picture. In order to bridge this theoretical gap and to understand on the same ground massive and massless quenches, we study the problem of a gaussian field characterized by a coupling parameter KK within a strip and a different one K_0K0 in the remaining two semi-infinite planes. We give a fully analytical solution using the electrostatic analogy with the problem of a dielectric material within a strip surrounded by an infinite medium of different dielectric constant, and exploiting the method of charge images. After analytic continuation, this solution allows us to obtain all the correlation functions after the quench within a path integral approach in imaginary time, thus recovering and generalizing the results in real time. Furthermore, this imaginary-time approach establishes a remarkable connection between the quench and the famous problem of the conductivity of a Tomonaga-Luttinger liquid coupled to two semi-infinite leads: the two are in fact related by a rotation of the spacetime coordinates.