latex (pdflatex) include png jpg … images

by

I always forget the package name to include, so here it is

\usepackage[pdftex]{graphicx}

Once included, the package provides the following term

\includegraphics[key_1 = . . . , key_2 = . . . ,  key_n=....]{filename}

Options (keys) include:

• scale = number — a magnification factor
• width = length — the width to which the figure should be scaled
• height = length — the height to which the figure should be scaled2
• totalheight = length — height plus depth of figure (to be used if figure  is rotated)
• keepaspectratio = true/false — maintains the height/width ratio
• angle = number — angle (in degrees) by which the figure is to be rotated  counter clockwise
• origin = location3 — the point about which rotation is to occur
• draft = true/false — prevents figure from being imported, but created   a named box with the dimensions of the figure (this option is used to speed  up processing)
• clip = true/false — excludes whatever is outside the bounding box
• bb = llx lly urx ury — enters the bounding box coordinates, which are   given by default in points (1/72 inch), manually (the bounding box might  be missing or you might want to alter it)
• viewport = llx lly urx ury — specifies bounding box w.r.t. bottom left of existing bounding box; used with clip to select a part of the image (or to  clear unwanted margins).
• trim = dllx dlly durx dury — reduces the bounding box by the amount  specified
• hiresbb = true/false — reads the bounding box information from the  line %%HiResBoundingBox in figure file

Detailed spec is here or a quickie can be found here

About these ads

15 Responses to “latex (pdflatex) include png jpg … images”

  1. Milena Says:

    I am trying to import a .png file (created originally with STATA and then converted to a .png file) and it is being imported as a black and white figure. Is there an option I can use to restore the colors? thanks

  2. Include picture in Texshop on mac latex | Brain Reset Says:

    [...] You can adjust the options in the bracket [], a small documentation you can found from here. [...]

  3. skizza Says:

    Milena umm are you sure that the file you are importing is not black and white? straight forward \includegraphics shouldn’t effect the colour.

    Brain Reset,
    can’t reply on your blog,
    > the myfig file need to be in the same path of the tex file;
    Not ness. for pdflatex – .. i often keep my figs under an image directory and use: \includegraphics[]{./image/foo.png}

    > no extension of the file should be appended, ex. png, jpg. I don’t know why, but if you add the extension, the texshop gave an fatal error. And the documentation of the texshop actually doesn’t have extension included either when it refers to include pdf and eps.
    pissy macs again i see !

    > If you get a missing bounding box error, please don’t go investigate bounding box, it’s not related as far as I see.

    this just means that the size of the figure of you are including is greater the space you have declared for it. so basically just resize it. to see the bounding box, use
    “\documentclass[draft]{}” this will show you the placeholder for the figures to be included.

    thanks

    thanks

  4. Zbigniew Says:

    see http://randomtech.blogspot.com/2004/11/latex-inserting-jpg-files.html

  5. Josiah Kiehl Says:

    Hey. When I add \usepackage[pdftex]{graphicx} to my document, it causes rubber to spin while compiling the document, and it never completes. It prints “Compiling ” over and over forever.

    Thoughts on why this is happening?

  6. Josiah Kiehl Says:

    I just tested in pdflatex, and it works fine.. I suppose I should go file a bug with the rubber team.

  7. rohit Says:

    when i write the following code in kile it gives me an error saying:
    File ‘chick’ not found. \includegraphics[scale=0.7]{chick}

    \documentclass[a4paper,15pt]{article}
    \usepackage[utf8x]{inputenc}
    \usepackage{multirow}
    \usepackage[pdftex]{graphicx}

    \pagestyle{plain}
    %opening
    \title{Telecom Software Lab}
    \author{Rohit Kumar Srivastava}
    \date{May 31,2010}

    \begin{document}
    \maketitle
    \newpage
    \begin{abstract}
    This is the first test in telecomm software lab.Topics are Unix Commands,Vi Editor Commands
    and Kile IDE
    \end{abstract}

    \newpage
    \section{Contents\\ \\ \\ \\ \\ }
    1. Mathematics\hspace{100mm} 4\\
    2. QR Decomposition\hspace{91.5mm} 6\\
    3. Tables \hspace{110mm} 8\\
    4. Figures \hspace{108.5mm} 9\\
    5. List of Figures\hspace{98mm} 10\\

    \newpage
    \section{Chapter \\ \\Mathematics}
    \begin{enumerate}
    \item (2 marks) the roots of the polynomial form \textsl{$x^3-3px-2q$} are given by
    formula\\ \textsl{$$\sqrt[3]{q+\sqrt{q^2-p^3}}+\sqrt[3]{q-\sqrt{q^2-p^3}}$$}
    where the values of the cube roots must are chosen so as to ensure that their product is equal to p.
    \item (1 Mark) The formula for finding Fourier Transform of \textbf{x(n)}
    is \textsl{$$X(e^(jw))=x(n)e^{-jwn} $$} W, in radians
    \item (1 Mark) Fundamental Principle in Trigonometry is
    \begin{eqnarray*}
    cos2\theta&=&cos^2{\theta}-sin^2{\theta}\\
    &=&2cos^2{\theta}-1
    \end{eqnarray*}
    \item (2 Marks)The \textsl{characteristic polynomial} $\chi(\lambda)$ of 3 X 3 matrix
    $$
    \left(
    \begin{array}{rcl}
    a&b&c\\
    d&e&f\\
    g&h&i\\
    \end{array}
    \right)
    $$
    is given by the formula \\

    $\chi(\lambda)=$\begin{tabular}{|c c c|}
    $\lambda -a$&-b&-c\\
    -d&$\lambda -e$&-f\\
    -g&-h&$\lambda -i$
    \end{tabular}

    \newpage
    \item (15 Marks) To calculate the pdf of a variable $Z_{max}=max(Z_1,Z_2,Z_3,Z_4)$ where\\
    $Z_1=f_1(textbf{X,Y})=|X_1+X_2+X_3|^2 + |Y_1+Y_2+Y_3|^2$ \\
    $Z_2=f_1(textbf{X,Y})=|X_1-X_2+X_3|^2 + |Y_1-Y_2+Y_3|^2$ \\
    $Z_3=f_1(textbf{X,Y})=|X_1+X_2-X_3|^2 + |Y_1+Y_2-Y_3|^2$ \\
    $Z_4=f_1(textbf{X,Y})=|X_1-X_2-X_3|^2 + |Y_1-Y_2-Y_3|^2$ \\
    You can write a symbolic solution to the PDF of any function Z=f(X) of a stochastis variable X as
    \\ \\
    $p(z)=\displaystyle\int p(x)\delta(z-f(x))\,dx$\\
    where $\displaystyle\delta(z)$ is a dirac delta function\\

    Thus, the PDF of $Z_{max} = max(Z_1,Z_2,Z_3,Z_4)$ can be written as \\
    $ p(z_{max}) = \displaystyle\int p(z)\displaystyle\delta (z_{max}-max(Z_1,Z_2,Z_3,Z_4))\,dz $\\
    where \\
    $ p(\textbf{z})=\displaystyle\int \displaystyle\int p(textbf{x,y}) \\prod_{k=1}^4 \displaystyle\delta(z_k-f_k(\textbf{x,y}))\,d\textbf{x}\,d\textbf{y} $\\
    $p(textbf{x,y})=p(x_1)p(x_2)p(x_3)p(y_1)p(y_2)p(y_3)$\\

    and integration with respect to a vector\\
    $\displaystyle\int . \,dx\\$
    \\
    stands for integration over all components: \\
    \\
    $\displaystyle\int_{-\infty}^\infty \displaystyle\int_{-\infty}^\infty \displaystyle\int_{-\infty}^\infty \,dx_1\,dx_2\,dx_3$

    \end{enumerate}
    \newpage
    \section{Chapter \\ \\QR Decomposition}

    (15 Marks) Channel model is \\ \\
    $Y_i=H_i*X_i+N_i $\\ \\
    The QR Decomposition of matrix yields to \\ \\
    $H_{i,up}=Q_i*R_i$ \\ \\
    where $Q_{i}$ is Unitary matrix and $R_i$ is upper Triangular matrix and there L channels \\ \\
    $\tilde{Y}_i = Q^*_iY_i = R_i*X_i + \tilde{N}_i$\\ \\
    $$
    (\tilde{X}_i)_k = decode\displaystyle{\left[
    \frac{1}{r^i_{k,k}}(\hat{Y}_i)_k - \displaystyle\sum_{j=k+1}^L \frac{r^i_{k,j}}{r^i_{k,k}}(\tilde{X}_i)_j
    \right]}
    $$
    \\ \\
    $k=L,L-1,……,1$ \\ \\
    The detection of SNR of user k on the $i^{th}$ is \\ \\
    $$S N R^i_k = |r^i_{k,k}|^2 * \varepsilon^i_{k,up}$$ \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad
    \qquad \qquad(2.3)\\ \\
    where $r^i_{k,j}$ is the $(k,j)$ element $R_i$ and $\epsilon ^i_{k,up}$ is the energy of ${(U_i)_k}$ \\
    The operations described above define the cancellor block corresponding to a \\
    single tone.\\
    The capacity can be found as\\
    $ R_{k,up} = \displaystyle\sum_{i\epsilon N_{up}} \frac{1}{2}\log_2(1+\frac{|r^i_{k,k}|^2 * \epsilon^i_{k,up}}{\Gamma})$ \\
    \newpage
    The above is general procedure for CR decomposition of Channel Matrix.\\ \\
    Now I am doing the QR decomposition of DM,DM-CM mode \\ \\
    channel
    \newpage
    \section{Chapter \\ \\Tables}

    \underline{{15 Marks}}\\ \\ \\
    \begin{center}
    \begin{tabular}{ | l | p{5cm} | p{3cm} | p{2.5cm} |}
    \hline
    Year & Degree/Exam & Institution Name & Aggregate marks(\%)/GPA \\ \hline
    2008–2010 & M.Tech in telecommunication Technology and management & Indian Institute of Technology, Delhi & /10 \\
    \hline
    2004–2008 & Bachelor of Technology in Electronics and Communications & N.S.I.T(Delhi University, Delhi) & 70\% \\
    \hline
    2002–2004 & AISSCE, Delhi & Bharatiya Vidya Bhavan’s,Mehta Vidyalaya & 87.4\% \\
    \hline
    2001–2002 & CBSE Board & Bharatiya Vidya Bhavan’s,Mehta Vidyalaya & 91.6\% \\
    \hline

    \end{tabular}
    \vspace{20mm}

    \end{center}

    \begin{tabular}{l p{3cm} p{3cm} *{7}{c}}

    \multicolumn{9}{c}{Table 3.1: Performance After Post Filtering} \\
    \hline \hline
    Audio & Audibility & Decision & \multicolumn {6}{c}{Sum of Extracted Bits} \\
    \hline
    \multirow{2}{*}{Police}& Soft & 1 & -1 & 1 & 1 & -1 & -1 & 1 \\
    & & Hard & 2 & -4 & 4 & 4 & -2 & -4 & 4 \\

    \multirow{2}{*}{Beethoven}& Soft & 1 & -1 & 1 & 1 & -1 & -1 & 1 \\
    & & Hard & 8 & -8 & 2 & 8 & -8 & -8 & 6 \\

    \multirow{2}{*}{Metallica}& Soft & 1 & -1 & 1 & 1 & -1 & -1 & 1 \\
    & & Hard & 4 & -8 & 8 & 4 & -8 & -8 & 8 \\
    \hline
    \end{tabular}
    \newpage
    \section{Chapter \\ \\Figures}

    \title{4 Marks\\ \\ \\}

    \includegraphics[scale=0.7]{chick}

    \newpage

    \section{Chapter \\ \\List of Figures}

    $4.1 \;$ PSD of\textsl Common Mode Channel at (25,5Mhz,300)$ |h_{12}|^2 + |h_{13}|^2 + \ldots + |h_{125}|^2 + ……………..$

    \end{document}

  8. rohit Says:

    please reply its
    urgent!!!!!!

  9. Irina Says:

    Hello,

    I am quite new to latex environment. I am using TexShop on a Mac an recently had problems with inserting a figure:

    \begin{figure}[h]
    \centering
    \includegraphics[width=16cm,draft=true]{//Users/PhD/LATEX THESIS/FIGURES THESIS/FIGURES THESIS CHAPTER 2//All data coverage SLP.pdf}
    \caption{Data coverage (\%) ICOADS SLP for four time periods}
    \label{fig:fig2.1}
    \end{figure}

    The figure is inserted, everything looks fine apart of the fact that on the top of the figure you can see the file name: //Users/PhD/LATEX THESIS/FIGURES THESIS/FIGURES THESIS CHAPTER 2//All data coverage SLP.pdf

    I really need to get rid of it somehow, but I did not manage.

    Thank you

  10. simon Says:

    @Irina: in my case this was due to the spaces in the filename, might want to check that

  11. Ever Says:

    how do I compute the bounding box for a PNG file ?

  12. free to use photos Says:

    free to use photos…

    [...]latex (pdflatex) include png jpg … images « Look here first![...]…

  13. Papa Orgen Says:

    I want to import a png file into my latex thesis. Originally, it was in a pdf file before i copied it to paint. Unfortunately, latex is says it can’t find my file on that partiular line. I saved it as fig1.png. I typed that into the \includegraphics space. Somebody help me. I am using latex version 2.09

  14. cheap harlett Says:

    I like reading an article that can make men and
    women think. Also, thank you for permitting me to comment!

  15. http://familyguytv.webstarts.com Says:

    What if I mentioned there were a perfectly legitimate means to
    get free Nintendo Points. Family Guy relies heavily on the use of flashbacks and also moments of exaggerated and extended comedic moments.
    LGMs.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Follow

Get every new post delivered to your Inbox.

%d bloggers like this: