5

I'm trying to add my gif file to my project. However, any suggestions on internet and forums are not working for me. I just have 11 pictures and i make them a gif file. How can i help a gif file or multiple picture at once like gif?

9
  • Does this help you?
    – user156344
    Commented May 24, 2019 at 8:42
  • As LaTeX and friends generally does not dupport gif, you'll have to convert it into a different format before use. May I ask: why did you save those images as gifd in the first place? Hardly anyone used gif anymore, besides for animated images.
    – daleif
    Commented May 24, 2019 at 8:44
  • i also have the images. Just converted to send via email. But now i need to add these images somehow
    – Ege Tunç
    Commented May 24, 2019 at 8:49
  • Don't use gif then, and don't use png (though supported, png takes like forever to get included).
    – Skillmon
    Commented May 24, 2019 at 8:49
  • @JouleV I have tried this, it didn't work for me
    – Ege Tunç
    Commented May 24, 2019 at 8:50

1 Answer 1

3

Edit You generally have tried many methods shown below with little success. For fun testing file to PDF animation on Overleaf try
1) Download http://mirrors.ctan.org/macros/latex/contrib/animate/animate.pdf
2) put it in a work folder (e.g. upload to Overleaf) and add this MWE Reader.tex file

\documentclass[]{standalone}
\usepackage{graphicx,animate} % for \animategraphics
\begin{document} %http://mirrors.ctan.org/macros/latex/contrib/animate/animate.pdf
\noindent\animategraphics[scale=0.9,controls,step]{0}{animate}{}{}
\end{document}

You should get a ONE Page reader.pdf. Now open that file in a suitable PDF animation reader (Acrobat, evince okular etc. Note SumatraPDF can handle sequenced pages but not animated ones) the 30 page document has now been animated into 1 page for your speed reading. Try this samples limited step controls to navigate and read a few select paragraphs. For a GIF pre converted to sequenced PDF you would remove that "step" option and replace the 0 with a much higher value.

GIF to PDF is easy but Animated GIF to PDF needs GIF TO PDF^2 and animate is perfect for this ^2 part

Having tried the older or more common solutions the most effective seems to be (embed images or vectors) with "animate" or more simply call the external gif in the same folder.

There are many ways to convert GIF frames to PNG or PDF for inclusion with TeX then they do not need to be supplied as additional files.

If the GIF is made of full frames then it is possible on Windows to open the file as frames for presentation or viewing, A little known SumatraPDF feature is that multi page TIFF or GIF frames can be SavedAs PDF the same as other supported image formats.

For some possible command line conversions see end of posting.

enter image description here

\documentclass[11pt]{article}
%\documentclass[]{beamer}
%\usepackage{movie15} % for \includemovie AVOID as obsolete use media 9
\usepackage{media9} % for \includemedia AVOID as about to expire
% \usepackage{pdfpc-commands} % for \inlineMovie OK BUT needs own .sty file see below
% \usepackage{xmpmulti} % For \multiinclude OK BUT uses slides in a sequence
\usepackage{multimedia}
\usepackage{graphicx} % for \animategraphics
\usepackage{animate} % for \animategraphics
\usepackage{hyperref} % (for \includemovie AVOID) Is needed for href fallback but not in Beamer class

%\def\bold#1{\bf#1\normalfont}
\begin{document}
\Large \textbf{2019 comparison of GIF to TeX solutions}\normalsize
\par \vspace{0.5cm}
% OLD movie15 will sometimes work HOWEVER you need a PDF reader that allows extract and run contents
% You may need to create a visible marker and it needs to be able to open the system default gif viewer
% Note the GIF is embedded and some viewers may allow extraction but not run or may not see a media player
\noindent \textbf{Movie15} (Requires active Flash Player)\newline
Simpler to just run externally detached via fallback\newline
%Click here to run GIF externally \texttt{>} \includemovie{1cm}{1cm}{anim.gif}
\par \vspace{0.5cm}
% Newer Media9 can include gif converted to modern mp4 movie, For this to work the viewer needs to have a 
% flash player installed this is depreciating and may not be useful technology soon
\noindent \textbf{Media9} (Requires active Flash Player)\newline
Simpler to just run externally detached via fallback\newline
 \includemedia[activate=onclick,width=2cm,height=2cm,addresource=anim.mp4,flashvars={source=anim.mp4&autoPlay=true  &loop=true}]{}{VPlayer.swf}
\par \vspace{0.5cm}
% Alternatively use well established AVI format with a special pdfpc style file NOTE requires that media
% permissions are relaxed to alow internal running
\noindent \textbf{pdfpc} (Requires Download from https://pdfpc.github.io/)\newline
% https://github.com/pdfpc/pdfpc#sample-presentations
Disabled here (see comments) but do consider for presentation use
\par 
%\inlineMovie[loop&autostart&start=1]{test.avi}{/anims/frame-0.png}{height=0.7\textheight}}
\vspace{0.5cm}
% Simple to animate a sequence of PNGs, so for a subfolder /anims/ containing frame-0.png to frame-5.png
% for finer details on conversion from GIF to PNG etc see https://tex.stackexchange.com/questions/240243/

% For Beamer we can sequence a number of slides using multiinclude {xmpmulti}
\noindent \textbf{Multiinclude} (For Beamer)\newline
Disabled here (see comments) but do consider for presentation use
\par
%\begin{frame}
%\transduration<0-5>{3} % speed
%\multiinclude[<+->][format=png, graphics={width=4cm}]{anims/frame} % files MUST be named frame-0 and up
%\end{frame}
\vspace{1cm}

% Animate works well with internal embeded png
%\movie[height = 0.7 \textwidth,width = 1.0 \textwidth]{}{anim.gif} % also mp4 mpg etc
\noindent \textbf{Animate}\newline\par
\noindent First example is 6 x single PNGs \hfill Second example is GIF2PDF\\ \raggedleft{conversion via SumatraPDF}\\ \raggedright
\animategraphics[controls,loop,autoplay,scale=1]{6}{anims/frame-}{0}{5} %6 is the fps value to open PNGs
\hfill \animategraphics[controls,loop,autoplay,scale=1]{6}{anim}{}{} %6 is the fps value to Display pages
\par \vspace{1cm}
\noindent \textbf{System Failback}\newline Just simply run any file in its own platform default viewer\\
\href{run:./anim.gif} {Run my external animated gif}

\end{document}          

If using command line converters to manipulate images some useful related options could be

GIF to PNG using gifsicle
gifsicle --unoptimize animated.gif | convert - frame-%d.png

For PDF to GIF out using ImageMagick (do not optimize)
convert -density 192 -delay 100 -loop 0 -background white -alpha remove input.pdf animated.gif

For PDF to PNG out using ImageMagick (NOT needed as animate can use PDF) convert -density 192 -strip input.pdf PNG8:frames/frame-%02d.png

For PNG to GIF convert -layers OptimizePlus -delay 100 -loop 0 frames/frame-?.png -delay 100 frames/frame-??.png animated.gif

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .