[texhax] Insert images .eps/.png

Heiko Oberdiek heiko.oberdiek at googlemail.com
Fri Dec 16 21:58:53 CET 2011


On Fri, Dec 16, 2011 at 04:42:33PM -0300, Darío Salvador Licata Caruso wrote:

> Hi list, i have a problem when i want to insert images generated by
> OCTAVE with next comand:
> 
> in the console OCTAVE:
> octave:NN>print -deps espectro.eps
> 
> this comand save the image generated by a function.
> 
> But when in tex archive write:
> 
> \begin{figure}[h]
>   \centering
>     \includegraphics[width=0.4
> \textwidth]{/media/disk/Documentos/espectro}
>   \caption{$I(\Delta L)$}
>   %\label{$\I(\lambda)$}
> \end{figure}
> 
> don't include graphic in the .dvi generated (with latex archive.tex).

You are using the wrong driver option for graphicx:

> \usepackage[pdftex]{graphicx}

Also I expect you have gotten error messages, e.g.
! Package pdftex.def Error: PDF mode expected, but DVI mode detected!

With DVI output the right driver option cannot be guessed
from within TeX, because the driver that reads DVI is called
*after* the TeX run. There are many: dvips, dvipdfm(x), xdvi, ...

Often the TeX distribution configures "dvips" as default
in graphics.cfg. Thus the driver option can be omitted, if
dvips is used.

> If the image is saved with the format .png, and then in console execute:
> pdflatex archive.tex 
> 
> get the following error:
> 
> Non-PDF special ignored!
> Non-PDF special ignored!
> Non-PDF special ignored!
> Non-PDF special ignored!
> Non-PDF special ignored!
> Non-PDF special

Usually these warnings are caused by wrong driver options or packages
that work with specials that are not supported by pdfTeX, typically
specials that contain PostScript (pstricks, ...).

> ignored!{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}]libpng
> error: Not a PNG file
> 
> !pdfTeX error: pdflatex (file /media/disk/Documentos/espectro.png):
> libpng: int
> ernal error
>  ==> Fatal error occurred, no output PDF file produced!
> 
> I think that the problem has to do format images, because only can
> opened with The Gimp and not with Visor Images currently  as Image
> Viewer.

* "Internal errors" should be reported as bug.
  As minimal file you can use something like

% test.tex
\catcode`\{=1
\catcode`\}=2
\pdfoutput=1
\setbox0=\hbox{%
  \pdfximage{espectro.png}% image file
  \pdfrefximage\pdflastximage
}
\pdfhorigin=0pt
\pdfvorigin=0pt
\pdfpagewidth=\wd0
\pdfpageheight=\ht0
\shipout\box0
\csname @@end\endcsname\end

  As image file "espectro.png" try to make a small image that causes the
  error. The minimal file then can be processed by inipdfTeX:
    pdftex --ini test.tex  

* Because PNG is a bitmap format with a fixed resolution, that cannot
  be changed later. Prefer vector based data, usually EPS, PDF, ...,
  (but caution, these formats also might contain bitmaps).
  

* http://www.gnu.org/software/octave/doc/interpreter/Printing-and-Saving-Plots.html#Printing-and-Saving-Plots
  lists several output devices. I expect as best choices for latex/dvips:
    eps(c)(2) (EPS, level 1/2 mono/color)
  For pdflatex:
    pdf
  Other choices are
    tikz (different drivers)
    epslatex, ... (latex/dvips)

EPS files can be converted by "epstopdf" or "ps2pdf -dEPSCrop" to PDF;
the reverse way can be achieved by xpdf's "pdftopdf -eps".

Yours sincerely
  Heiko Oberdiek


More information about the texhax mailing list