[l2h] Requesting sample code used in a .tex file for including animated figures, presently as .gif files, in output .pdf and/or .html files/file, et cetera

Pat Somerville l_pat_s at hotmail.com
Fri Nov 2 03:13:28 CET 2012


Thanks for kindly taking the time to write to me again, Nasser M. Abbasi.  I 
did not produce the .gif (Graphic Interchange Format) files I have recently 
been using.  And I have no 21st century experience making an animated .gif 
file.  I have been concerned with how to place a couple of animations in 
.html and .pdf files.  Your answer was good for placing them in a .html 
file.  Thanks for kindly providing it for me.  I used the programs LaTeX and 
LaTeX2HTML in producing the .html file containing those animations.

I have found placing animations in a .pdf (Portable Document Format) file 
beginning with a .gif animation challenging.  At this stage my result in 
having animations in a .pdf file appears quite primitive compared to putting 
the animations in a .html file.  Nevertheless here I will describe some of 
what I have done so far in that direction.  None of the following writing 
has anything to do with LaTeX2HTML.  But, if it is okay with the people in 
the LaTeX2HTML users' group, perhaps someone in it can write some helpful 
advice for me.  If there is a TeX users' group for the use of the program 
pdflatex, that would probably be a more appropriate group in which to 
discuss the following matters.

>From http://en.wikipedia.org/wiki/User: Derbeth/javalatex I learned that 
pdflatex does not support the use of .gif images.  From what I have read on 
the Internet at least one way to deal with this matter is to convert the 
.gif images in an animated .gif file to a series of .png (Portable Network 
Graphics) images, one for each frame in the .gif file containing an 
animation.  Following the advice on the Web page 
http://modb.oce.ulg.ac.be/mediawiki/index.php/How_to_create_animation_(Linux)%3F I 
installed the free program ImageMagick in a Windows XP Home Edition 
operating system and subsequently used a command in a command-prompt of the 
following form to effect the conversion from an animated .gif file to a 
series of .png files:

convert MyFile.gif MyFile%05d.png

.  The result was that gratefully many .png images were produced with names 
of the form MyFile00000.png, MyFile00001.png, MyFile00002.png, et cetera 
(Previously I had downloaded something from ImagicMagick's Web site which 
appeared to provide online conversion of a file from the .gif to the .png 
format in my Mozilla Firefox Web browser.  By clicking on "File Tools" right 
on my Firefox Web browser and then selecting "Image Converter" among the 
subsequent choices I could have access to that capability.  But that 
conversion did not work for me.).

Previously I had installed Alexander Grahn's animate software package for 
TeX Live in an openSUSE-12.2, Linux operating system.  I think I obtained it 
via the Comprehensive TeX Archive Network (CTAN) Web site 
http://tug.ctan.org/tex-archive/macros/latex/contrib/animate/doc/animate.pdf. 
Following some of probably his or else Jim Hefferon's advice I had 
downloaded the file animate.zip and in my case extracted its contents in the 
directory /usr/share/texmf.  Fortunately most, if not all of the software 
requirements for the animate software package appear to be contained in a 
modern version of TeX Live.---Unless this was done for me in the process of 
updating openSUSE-12.2 software, at least I haven't knowingly and especially 
downloaded and installed any new software packages other than the animate 
package to add to my installation of TeX Live lately.

For the purpose of making the .pdf output file containing animated figures I 
followed much of Alexander Grahn's advice and input or else already had 
commands of the following form into my .tex file:

\documentstyle[a4paper,12pt]{article}
\usepackage{animate,graphicx}

\begin{document}
In \hyperref[ref]{Figure (Fig. 1)}{Figure (Fig. 1)}{}{MyFigure}

\begin{figure}

\begin{center}
\animategraphics{30}{MyFile}{00000}{00097}
%for 30 frames/second each with a name of the form MyFile00000.png, 
MyFile00001.png, ........, MyFile00097.png
%Figure caption here
\label{MyFigure}
\end{center}
\end{figure}
.....
.....
\end{document}
.

Then I executed the command of the form "pdflatex MyFile.tex".  Following 
that execution I eventually opened the output file with a name of the form 
MyFile.pdf in Acrobat Reader 9.5.1 and Adobe Reader X 10.1.4.  I think in 
each case I had to click on an animated image in the .pdf file to start its 
animation after seeing the image of I think a small, white, right hand with 
an upward-pointing index finger on it.  But after that first clicking a 
popup window appeared containing the message "Please Note: Click 'sign' to 
fill out and sign this form," a message which did not apply to my .pdf file. 
After closing that window by perhaps clicking on an "X" in its 
upper-right-hand corner, I think the animation began.  I think the animation 
was executed once for each click on an animated figure in the .pdf file. 
(It seems like I might have seen somebody else's .pdf file containing an 
animated figure which did not require my clicking on it to get that 
animation started.  That animation might have only been the drawing of a 
colored curve.  And that animation might have continued in a repetitive 
fashion.  If so, I think I like those behaviors better for a reader of a 
.pdf document than the ones I obtained which I report here.).  There were 
some problems:

1) The vertical dimension appeared to be compressed compared to the 
horizontal dimension.  The animations each proceeded from left to right.  By 
the time the final frame was reached in the animation the vertical dimension 
was obviously highly compressed compared to the horizontal dimension.  And I 
think the horizontal dimension of an object in the animation may have been 
horizontally stretched in the course of the animation so that the last image 
showed an object or objects which were much more horizontally stretched than 
at the beginning of the animation.  Right now I suppose I can't rule out the 
possibility that what I saw could be explained by just the horizontal 
stretching alone without any vertical compression.---The result of either 
stretching in the horizontal dimension or compression in the vertical 
dimension makes a circle appear as an ellipse that is longer in the 
horizontal than in the vertical direction.

2) Although one to-be animated image initially had good color and 
proportions between its vertical and horizontal components before starting 
the animation with a click on it, I think parts of the frame images could 
not be seen at all during the course of the animation.---That is during the 
animation I think parts of the image could be seen; and parts of them could 
not be seen.

I suppose that if by me doing things more correctly than I have up to now 
that better results could imaginably be obtained for animated figures in a 
.pdf file produced from an animation originally contained in a .gif file.

Pat

--------------------------------------------------
From: "Pat Somerville" <l_pat_s at hotmail.com>
Sent: Wednesday, October 31, 2012 6:37 PM
To: <latex2html at tug.org>
Subject: Re: [l2h] Requesting sample code used in a .tex file for including 
animated figures, presently as .gif files, in output .pdf and/or .html 
files/file, et cetera

> Thanks, Nasser M. Abbasi, for kindly taking the time to promptly send me 
> your advice!
> Your advice was basically good for me! I found that in my .tex file I 
> could
> put a set of
> commands of the form
>
> \begin{htmlonly}
> \includegraphics[scale=0.5]{file.gif}
> \end{htmlonly}
>
> within a LaTeX figure environment that includes the early command
> \begin{figure} and the later command \end{figure}.  I adjusted [scale=1.0]
> some with values of "scale" less than one for the .gif figures I was 
> using.
> A simplification in my case was that I was able to use the animated .gif
> files available to me as the final, single, .gif files in each case.  I
> think at least one of them may have contained tens of frames, based on 
> what
> I saw in the Gnu's Not Unix (GNU) Image Manipulation Program (GIMP).
>
> The remaining challenge for me in having the output file made was that in
> the
> output, .html file produced via latex .... and latex2html .... commands on
> my .tex file that the animations either sometimes or nearly always did not
> have time to be completed before they were automatically restarted.  The
> animations appear to have been set to continually be run and rerun as long
> as the .html file containing them was open in my Konqueror-4.8.5, 
> release-2,
> Web browser; and
> no clicking by me was necessary to start either of those two animations.
> This problem did not occur, however, in the Mozilla Firefox-16.0.1 Web
> browser.  From http://bugs.kde.org/show_bug.cgi?id=237330 on the Internet 
> as
> of February 23, 2012 this was a problem in Konqueror and/or the K Desktop
> Environment (KDE) versions 4.6.2, 4.6.5, and 4.7.00.   There a route to 
> the
> trouble was reported as: "The problem is that whenever an image has a
> width/height definition which is different from the image's original size,
> the animation is not done," with me slightly editing the punctuation edits
> in that quotation.  But in my case I could report that the animation was
> partly completed after having made a size change on a .gif figure. Via
> Konqueror 4.8.5, release-2's "Settings, Configure Konqueror, General,
> Default Web browser engine" I discovered that I was already using the 
> WebKit
> Web-browser engine in Konqueor 4.8.5, release 2; yet the problem with .gif
> animations not being completed existed.  So from the quoted advice I 
> forced
> LaTeX and LaTeX2HTML to work with versions of the .gif files in which 
> their
> physical sizes had not been changed; to me that meant including 
> [scale=1.0]
> in my .tex file, just as you wrote me.  Gratefully the result was good 
> doing
> that in the output, .html file when viewed in Konqueror!  Apparently some
> default resizing of one or two of .gif files was accomplished by latex or
> latex2html because the size of one of those .gif files in the Konqueror 
> Web
> browser on my computer screen was certainly less than the 25-inch width
> "reported" for it by GIMP.  So thanks, Nasser M. Abbasi.  Your advice was
> simple and excellent concerning the production of a .html file containing
> animated .gif files!
>
> Next,  how should I produce animations in .gif files in a  Portable 
> Document
> Format (.pdf) output file, starting from a .tex file?  I discovered that I
> probably have pdftex and pdflatex in my installation of TeX Live in an
> openSUSE-12.2, Linux operating system.  So I tried entering commands of 
> the
> form "pdftex MyFile.tex" and "pdflatex MyFile.tex" on my .tex file.  The
> result with pdftex was an "objection" to at least the LaTeX command
> \documentstyle[a4paper,12pt]{article}.  The result using pdflatex was that 
> a
> .pdf output file with a name of the form MyFile.pdf was produced, in
> addition to some conversions of some figure files which apparently 
> occurred.
> On viewing the output, .pdf file in I think each of the programs Okular 
> and
> Adobe Reader 9.5.1, the animated figures could not be found in it.  So
> please inform me how to arrange my .tex file referencing animated .gif (or
> perhaps .png)  files so that by executing pdftex or pdflatex or some other
> program on it an output, .pdf file containing animated figures can be
> produced.
>
> Pat
>
> --------------------------------------------------
> From: "Nasser M. Abbasi" <nma at 12000.org>
> Sent: Wednesday, October 31, 2012 9:13 AM
> To: <latex2html at tug.org>
> Subject: Re: [l2h] Requesting sample code used in a .tex file for 
> including
> animated figures, presently as .gif files, in output .pdf and/or .html
> files/file, et cetera
>
>> On 10/31/2012 2:59 AM, Pat Somerville wrote:
>>
>> Pat;
>>
>> This is how I add animated gif files to my Latex document for
>> use with l2h. I do the conversion on windows, but the resulting
>> animated gif file can of course be used on windows on Linux with
>> l2h
>>
>> 1) Tool needed on windows (free)
>>    - UNFreeze to convert the GIF files to animated gif.
>> 2) Use the above program to convert the set of gif file to one
>> animated gif file, say animation.gif
>>
>> in Latex, do the line
>>
>> -----------------------------
>> \documentclass[12pt]{article}
>> \usepackage{graphicx}
>> \usepackage{html}
>>
>> \begin{document}
>> \begin{htmlonly}
>> \includegraphics[scale=1]{animation.gif}
>> \end{htmlonly}
>> \end{document}
>> --------------------------------------
>>
>> If the files are .png files, then first convert them to
>> gif files and then do the above. To covert set of png files
>> to set of gif files, I use free program call EazyGraphics
>> converter to convert PNG to GIF.
>>
>> --Nasser
>>
>>
>>
>> _______________________________________________
>> latex2html mailing list
>> latex2html at tug.org
>> http://tug.org/mailman/listinfo/latex2html
>> 


More information about the latex2html mailing list