Is it possible to invert an image (the format is png, jpg, bmp) with respect to the given reference circle in LaTeX? Can we transform the individual pixels (e.g. with complex transformations such as Möbius transformation)?

Mathematical inversion is a geometric transformation of the Euclidean plane. In coordinate geometry if the reference circle is the unit circle and P(x,y) is not the origin, then the image of P(x,y) is P'(\frac{x}{x^2+y^2},\frac{y}{x^2+y^2}). In the complex plane if the reference circle is the unit circle and z is not the origin, then its image is z'=\overline{1/z}.

(P.S. How to filter far images of points from the origin?)

  • Welcome! You can't use .bmp anyway, unless you are transforming it. (Certainly won't work here out-of-the-box.) Even if the transformation can/could be done in TeX (it is presumably possible in some abstract sense, provided a digital computer could do it), you will be much better using an external tool.
    – cfr
    Jun 10, 2017 at 23:11
  • I don't understand the postscript.
    – cfr
    Jun 10, 2017 at 23:11
  • #cfr If P(x,y) tends to the origin then its image tends to infinity. It is one property of the inversion. Look P'(,) 's denominator!
    – csekri
    Jun 10, 2017 at 23:15
  • And what about png and jpg? I can convert pictures with external tool (e.g. ffmpeg) so I need only one suitable format.
    – csekri
    Jun 10, 2017 at 23:33
  • 1
    @csekri: Indeed, I removed my previous comment because, on second thought, I saw that what you are asking for could make some sense; nonetheless, I still deem it crazy! But according to Bernard’s comment, it is not crazy enough to discourage somebody from actually implementing it… :-)
    – GuM
    Jun 11, 2017 at 0:57

1 Answer 1


Because why not?



    \draw circle(.05)circle(5)
    \foreach\i in{-10,...,9}{
        \foreach\j in{-10,...,9}{
            \pgfmathsetmacro\xx{fx (\i,\j)}
            \pgfmathsetmacro\yy{fy (\i,\j)}
                \pgfsettransformentries{\aa}{\ab}{\ba}{\bb}{\xx cm}{\yy cm}
            \pgfmathsetmacro\aa{fxx(\i  ,\j+1)}
            \pgfmathsetmacro\ab{fxy(\i  ,\j+1)}
            \pgfmathsetmacro\ba{fyx(\i+1,\j  )}
            \pgfmathsetmacro\bb{fyy(\i+1,\j  )}
            \pgfmathsetmacro\xx{fx (\i+1,\j+1)}
            \pgfmathsetmacro\yy{fy (\i+1,\j+1)}
                \pgfsettransformentries{\aa}{\ab}{\ba}{\bb}{\xx cm}{\yy cm}


code taken from https://tex.stackexchange.com/a/332173/51022.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.