# jpg image is flipped upside down

I am assembling figures for my thesis using:

\documentclass[12, twoside]{report}
\usepackage{textcomp}
\usepackage{graphicx}
\usepackage[a4paper,margin=1in]{geometry}
\begin{document}
\graphicspath{{./Figures/}}

\begin{figure}[htbp]
\includegraphics[width=\textwidth]{Figure1.pdf}
\caption[short]{\textbf{Cancer incidences of different age groups in Canada for 2010.} For both men and women, the five cancer types with the highest incidence rates of new primary cancer were plotted. This figure shows that incidence rates increase with age, indicating that cancer requires decades to progress in adults. \textit{Data: CANSIM table 103-0550, Statistics Canada. Accessed: April 4th, 2015}}
\end{figure}

\clearpage
\begin{figure}[htbp]
\includegraphics[width=\textwidth]{Figure2.png}
\caption{\textbf{Canadian women breast cancer estimates.} It is expected that approximately 1/9 women will be diagnosed with breast cancer during her lifetime, and 1/30 will die from it. \textit{Source: Canadian Cancer Society's 2009 estimates.}}
\end{figure}

\clearpage
\begin{figure}[htbp]
\includegraphics[width=\textwidth]{Figure3.pdf}
\caption{\textbf{Log-log plots of cancer mortality rates in Canada for 2010.} This figures shows that cancer overall requires at least six steps for both men and women (A,B). Additionally, the mathematical modelling of the influence and fluctuating estrogen levels on breast cancer is consistent with the epidemiological data (C). Colon cancer in women is used as control because it is hormonally independent (D). \textit{Data: CANSIM tables 051-0522 and 102-0522, Statistics Canada. Accessed: April 4th, 2015}}
\end{figure}

\clearpage
\begin{figure}[htbp]
\includegraphics[width=\textwidth]{Ur.pdf}
\caption[short]{\textbf{Ziggurat of Ur.} This Ziggurat was built during the 21st century BC by the neo-Sumerians in the city (now ruins) of Ur, Irak in honor of their moon God, Nanna (A). It originally
had three main levels, but only two now remain (B). Several restoration efforts have been carried out. The sketch was drawn by British archaeologist Sir Leonard Woolley who excavated Ur in the 1920s. Interestingly, he proposed that Ur was Ur of Chaldees, the birthplace of the biblical patriarch Abraham (Genesis 11:31). While hoping to uncover Abraham's home, Woolley famously found the Ur's royal cemetery that included ~2000 burials. \textit{Source: http://oracc.museum.upenn.edu/amgg/listofdeities/nannasuen/, http://www.penn.museum/press-releases/650-iraqs-ancient-past-press-release.html, Bible. Accessed: May 11th, 2015}}
\end{figure}

\clearpage
\begin{figure}[htbp]
\includegraphics[width=\textwidth]{boxplots.pdf}
\caption[short]{\textbf{Identification of Arm-level and Focal Events of Claudin-low tumors in METABRIC}}
\end{figure}

\begin{figure}[htbp]
\includegraphics[width=\textwidth]{rawCopy.jpg}
\caption[short]{\textbf{Raw copy number of claudin-low tumors}}
\end{figure}

\end{document}


Here is the jpg image:

However, the jpg image is inverted, and I don't know why...

I would greatly appreciate the community's input. Thank you!

EDIT:

• Try with \includegraphics[width=\textwidth,angle=180]{rawCopy.jpg} – user11232 May 14 '15 at 1:34
• @HarishKumar Hi Harish! I tried, but it's still not right. Please see the EDIT Latex should be able to support jpg, no? – Johnathan May 14 '15 at 1:37
• I get it alright So I am not able to reproduce the issue. – user11232 May 14 '15 at 1:44
• @HarishKumar With your modification to my code? If you don't mind, could you please copy-and-paste your modification? I am using sharelatex, so I'll just copy-and-paste as well, and see what happens... Weird... haha – Johnathan May 14 '15 at 1:49
• Use a different viewer than you usually use and look at the jpg image in your graphics directory. You may have been given unexpected assistance from you usual viewer. – R. Schumacher May 14 '15 at 1:57

By now, it might be too late for the OP. But I found a solution recently when I was trying to flip the image horizontally. Future visitor might find it useful :-D [Solution was a result of combination of two ideas from here and here]

Code goes here:

\documentclass{article}
\usepackage{tikz,subcaption}
\usetikzlibrary{positioning}

\begin{document}
% Vertical flip
\begin{figure}
\begin{subfigure}[b]{.5\textwidth}
\begin{tikzpicture}
\node[scale=0.4] (a)
{ \scalebox{1}[1]{\includegraphics[scale=1]{example-image-a}} };
\end{tikzpicture}
\caption{}
\end{subfigure}
\begin{subfigure}[b]{.5\textwidth}
\begin{tikzpicture}
\node[scale=0.4] (a)
{ \scalebox{1}[-1]{\includegraphics[scale=1]{example-image-a}} };
\end{tikzpicture}
\caption{}
\end{subfigure}
\caption{Vertical flip of .jpg or .pdf files}
\end{figure}
% Horizontal flip
\begin{figure}
\begin{subfigure}[b]{.5\textwidth}
\begin{tikzpicture}
\node[scale=0.4] (a)
{ \scalebox{1}[1]{\includegraphics[scale=1]{example-image-b}} };
\end{tikzpicture}
\caption{}
\end{subfigure}
\begin{subfigure}[b]{.5\textwidth}
\begin{tikzpicture}
\node[scale=0.4] (a)
{ \scalebox{-1}[1]{\includegraphics[scale=1]{example-image-b}} };
\end{tikzpicture}
\caption{}
\end{subfigure}
\caption{Horizontal flip of .jpg or .pdf files}
\end{figure}
\end{document}


And the output here:

• Thank you very much for your feedback! I have submitted my thesis, but I will definitively keep that in mind for my next document! :) – Johnathan Jun 3 '16 at 16:43

I just had a similar issue. For me the problem was EXIF data in jpg file.

Basically, the image is saved in other direction and has a flag that tells image viewers to rotate it. It's better to rotate the image this way, since each file rotation transformation lowers the quality.

The best solution would be to make latex to use this flag. The simplest - just overwrite the image.

I check it with Pinta and GIMP - both saves it as correctly rotated image without EXIF "rotate" information. In Pinta you have to use save as option. When I opened the image with GIMP I got such a message:

According to the EXIF data, this image is rotated.
Would you like GIMP to rotate it into the standard orientation?


Choose to rotate and then file > overwrite.

I had the same problem and I was able to solve it by opening the file on imageJ (it's a free image processing program), and re-saving it as a jpg or whatever format you want to use.