Convert GIF image to PNG on the fly












16















I am using pdflatex on Linux and attempting to convert GIF to PNG.
I can run scripts to find out the image attributes and even and convert
the files supplied from a folder but I can not write back to that
folder (or I'd convert them by hand). I have hundreds of gif files.



I have found great instructions with regard to converting GIF to EPS. Those
weren't working for me, so I thought I'd try PNG files because I normally
use PNG files. Thanks in advance for your time for reading and any comments.



Before begin{document}, I have defined:



DeclareGraphicsExtensions{.gif, .ps, .eps, .png}
DeclareGraphicsRule{.gif}{png}{}{`convert #1 'png:-'}


Inside my document, I have



includegraphics{figures/filename.gif}


When I run pdflatex on my document, I get an error:



! LaTeX Error: Cannot determine size
of graphic in `convert
figures/filename.gif 'png:-' (no size
specifed).


So, I added a bounding box manually to the includegraphics command:



includegraphics[0,0][18,18]{figures/filename.gif}


I got the dimensions using imagemagick's identify command.



I am able to convert the file, write it to a new file, and view it using imagemagick:



$ convert figures/filename.gif gif:figures/filename.png


I believe that the "convert" command I specified in the graphics rule is not actually running. What am I doing wrong?



Here are some details about my build:



$ pdflatex test.tex
This is pdfTeX, Version 3.14159-14h-released-20010417 (Web2C 7.3.3.1)
(./test.tex{pdftex.cfg}
LaTeX2e <2001/06/01>
Babel <v3.7h> and hyphenation patterns for american, french, german, ngerman, i
talian, nohyphenation, loaded.
(/usr/share/texmf/tex/latex/base/article.cls
Document Class: article 2001/04/21 v1.4e Standard LaTeX document class
(/usr/share/texmf/tex/latex/base/size10.clo))
(/usr/share/texmf/tex/latex/tools/verbatim.sty)
(/usr/share/texmf/tex/latex/fancyhdr/fancyhdr.sty)
(/usr/share/texmf/tex/latex/graphics/graphicx.sty
(/usr/share/texmf/tex/latex/graphics/keyval.sty)
(/usr/share/texmf/tex/latex/graphics/graphics.sty
(/usr/share/texmf/tex/latex/graphics/trig.sty)
(/usr/share/texmf/tex/latex/config/graphics.cfg)
(/usr/share/texmf/tex/latex/graphics/pdftex.def)))
(/usr/share/texmf/tex/latex/base/makeidx.sty)
Writing index file test.idx
(/usr/share/texmf/tex/latex/misc/pslatex.sty)
(/usr/share/texmf/tex/latex/pdfpages/pdfpages.sty
(/usr/share/texmf/tex/latex/base/ifthen.sty)
(/usr/share/texmf/tex/latex/tools/calc.sty)
(/usr/share/texmf/tex/latex/ms/eso-pic.sty
(/usr/share/texmf/tex/latex/ms/everyshi.sty))))

LaTeX Warning: Unused global option(s):
[8pt,english].

No file test.aux.
(/usr/share/texmf/tex/latex/psnfss/omspzccm.fd)
(/usr/share/texmf/tex/context/base/supp-pdf.tex
(/usr/share/texmf/tex/context/base/supp-mis.tex
loading : Context Support Macros / Missing
)
loading : Context Support Macros / PDF
) (/usr/share/texmf/tex/latex/psnfss/ot1ptmcm.fd)
(/usr/share/texmf/tex/latex/psnfss/omlptmcm.fd)
(/usr/share/texmf/tex/latex/psnfss/omxpsycm.fd)
<use `convert figures/remconf_edit.gif 'png:-'> [1{/usr/share/texmf/dvips/confi
g/pdftex.map}] (/usr/share/texmf/tex/latex/psnfss/omsphv.fd) [2] [3] [4]
(./test.aux) )</usr/share/texmf/fonts/type1/bluesky/cm/cmsy10.pfb>{/usr/share/t
exmf/dvips/base/8r.enc}









share|improve this question

























  • Can't you dump converted images into another folder? Do you absolutely have to grab them from the read-only folder where they are now?

    – ajeh
    Feb 5 '14 at 18:51
















16















I am using pdflatex on Linux and attempting to convert GIF to PNG.
I can run scripts to find out the image attributes and even and convert
the files supplied from a folder but I can not write back to that
folder (or I'd convert them by hand). I have hundreds of gif files.



I have found great instructions with regard to converting GIF to EPS. Those
weren't working for me, so I thought I'd try PNG files because I normally
use PNG files. Thanks in advance for your time for reading and any comments.



Before begin{document}, I have defined:



DeclareGraphicsExtensions{.gif, .ps, .eps, .png}
DeclareGraphicsRule{.gif}{png}{}{`convert #1 'png:-'}


Inside my document, I have



includegraphics{figures/filename.gif}


When I run pdflatex on my document, I get an error:



! LaTeX Error: Cannot determine size
of graphic in `convert
figures/filename.gif 'png:-' (no size
specifed).


So, I added a bounding box manually to the includegraphics command:



includegraphics[0,0][18,18]{figures/filename.gif}


I got the dimensions using imagemagick's identify command.



I am able to convert the file, write it to a new file, and view it using imagemagick:



$ convert figures/filename.gif gif:figures/filename.png


I believe that the "convert" command I specified in the graphics rule is not actually running. What am I doing wrong?



Here are some details about my build:



$ pdflatex test.tex
This is pdfTeX, Version 3.14159-14h-released-20010417 (Web2C 7.3.3.1)
(./test.tex{pdftex.cfg}
LaTeX2e <2001/06/01>
Babel <v3.7h> and hyphenation patterns for american, french, german, ngerman, i
talian, nohyphenation, loaded.
(/usr/share/texmf/tex/latex/base/article.cls
Document Class: article 2001/04/21 v1.4e Standard LaTeX document class
(/usr/share/texmf/tex/latex/base/size10.clo))
(/usr/share/texmf/tex/latex/tools/verbatim.sty)
(/usr/share/texmf/tex/latex/fancyhdr/fancyhdr.sty)
(/usr/share/texmf/tex/latex/graphics/graphicx.sty
(/usr/share/texmf/tex/latex/graphics/keyval.sty)
(/usr/share/texmf/tex/latex/graphics/graphics.sty
(/usr/share/texmf/tex/latex/graphics/trig.sty)
(/usr/share/texmf/tex/latex/config/graphics.cfg)
(/usr/share/texmf/tex/latex/graphics/pdftex.def)))
(/usr/share/texmf/tex/latex/base/makeidx.sty)
Writing index file test.idx
(/usr/share/texmf/tex/latex/misc/pslatex.sty)
(/usr/share/texmf/tex/latex/pdfpages/pdfpages.sty
(/usr/share/texmf/tex/latex/base/ifthen.sty)
(/usr/share/texmf/tex/latex/tools/calc.sty)
(/usr/share/texmf/tex/latex/ms/eso-pic.sty
(/usr/share/texmf/tex/latex/ms/everyshi.sty))))

LaTeX Warning: Unused global option(s):
[8pt,english].

No file test.aux.
(/usr/share/texmf/tex/latex/psnfss/omspzccm.fd)
(/usr/share/texmf/tex/context/base/supp-pdf.tex
(/usr/share/texmf/tex/context/base/supp-mis.tex
loading : Context Support Macros / Missing
)
loading : Context Support Macros / PDF
) (/usr/share/texmf/tex/latex/psnfss/ot1ptmcm.fd)
(/usr/share/texmf/tex/latex/psnfss/omlptmcm.fd)
(/usr/share/texmf/tex/latex/psnfss/omxpsycm.fd)
<use `convert figures/remconf_edit.gif 'png:-'> [1{/usr/share/texmf/dvips/confi
g/pdftex.map}] (/usr/share/texmf/tex/latex/psnfss/omsphv.fd) [2] [3] [4]
(./test.aux) )</usr/share/texmf/fonts/type1/bluesky/cm/cmsy10.pfb>{/usr/share/t
exmf/dvips/base/8r.enc}









share|improve this question

























  • Can't you dump converted images into another folder? Do you absolutely have to grab them from the read-only folder where they are now?

    – ajeh
    Feb 5 '14 at 18:51














16












16








16


3






I am using pdflatex on Linux and attempting to convert GIF to PNG.
I can run scripts to find out the image attributes and even and convert
the files supplied from a folder but I can not write back to that
folder (or I'd convert them by hand). I have hundreds of gif files.



I have found great instructions with regard to converting GIF to EPS. Those
weren't working for me, so I thought I'd try PNG files because I normally
use PNG files. Thanks in advance for your time for reading and any comments.



Before begin{document}, I have defined:



DeclareGraphicsExtensions{.gif, .ps, .eps, .png}
DeclareGraphicsRule{.gif}{png}{}{`convert #1 'png:-'}


Inside my document, I have



includegraphics{figures/filename.gif}


When I run pdflatex on my document, I get an error:



! LaTeX Error: Cannot determine size
of graphic in `convert
figures/filename.gif 'png:-' (no size
specifed).


So, I added a bounding box manually to the includegraphics command:



includegraphics[0,0][18,18]{figures/filename.gif}


I got the dimensions using imagemagick's identify command.



I am able to convert the file, write it to a new file, and view it using imagemagick:



$ convert figures/filename.gif gif:figures/filename.png


I believe that the "convert" command I specified in the graphics rule is not actually running. What am I doing wrong?



Here are some details about my build:



$ pdflatex test.tex
This is pdfTeX, Version 3.14159-14h-released-20010417 (Web2C 7.3.3.1)
(./test.tex{pdftex.cfg}
LaTeX2e <2001/06/01>
Babel <v3.7h> and hyphenation patterns for american, french, german, ngerman, i
talian, nohyphenation, loaded.
(/usr/share/texmf/tex/latex/base/article.cls
Document Class: article 2001/04/21 v1.4e Standard LaTeX document class
(/usr/share/texmf/tex/latex/base/size10.clo))
(/usr/share/texmf/tex/latex/tools/verbatim.sty)
(/usr/share/texmf/tex/latex/fancyhdr/fancyhdr.sty)
(/usr/share/texmf/tex/latex/graphics/graphicx.sty
(/usr/share/texmf/tex/latex/graphics/keyval.sty)
(/usr/share/texmf/tex/latex/graphics/graphics.sty
(/usr/share/texmf/tex/latex/graphics/trig.sty)
(/usr/share/texmf/tex/latex/config/graphics.cfg)
(/usr/share/texmf/tex/latex/graphics/pdftex.def)))
(/usr/share/texmf/tex/latex/base/makeidx.sty)
Writing index file test.idx
(/usr/share/texmf/tex/latex/misc/pslatex.sty)
(/usr/share/texmf/tex/latex/pdfpages/pdfpages.sty
(/usr/share/texmf/tex/latex/base/ifthen.sty)
(/usr/share/texmf/tex/latex/tools/calc.sty)
(/usr/share/texmf/tex/latex/ms/eso-pic.sty
(/usr/share/texmf/tex/latex/ms/everyshi.sty))))

LaTeX Warning: Unused global option(s):
[8pt,english].

No file test.aux.
(/usr/share/texmf/tex/latex/psnfss/omspzccm.fd)
(/usr/share/texmf/tex/context/base/supp-pdf.tex
(/usr/share/texmf/tex/context/base/supp-mis.tex
loading : Context Support Macros / Missing
)
loading : Context Support Macros / PDF
) (/usr/share/texmf/tex/latex/psnfss/ot1ptmcm.fd)
(/usr/share/texmf/tex/latex/psnfss/omlptmcm.fd)
(/usr/share/texmf/tex/latex/psnfss/omxpsycm.fd)
<use `convert figures/remconf_edit.gif 'png:-'> [1{/usr/share/texmf/dvips/confi
g/pdftex.map}] (/usr/share/texmf/tex/latex/psnfss/omsphv.fd) [2] [3] [4]
(./test.aux) )</usr/share/texmf/fonts/type1/bluesky/cm/cmsy10.pfb>{/usr/share/t
exmf/dvips/base/8r.enc}









share|improve this question
















I am using pdflatex on Linux and attempting to convert GIF to PNG.
I can run scripts to find out the image attributes and even and convert
the files supplied from a folder but I can not write back to that
folder (or I'd convert them by hand). I have hundreds of gif files.



I have found great instructions with regard to converting GIF to EPS. Those
weren't working for me, so I thought I'd try PNG files because I normally
use PNG files. Thanks in advance for your time for reading and any comments.



Before begin{document}, I have defined:



DeclareGraphicsExtensions{.gif, .ps, .eps, .png}
DeclareGraphicsRule{.gif}{png}{}{`convert #1 'png:-'}


Inside my document, I have



includegraphics{figures/filename.gif}


When I run pdflatex on my document, I get an error:



! LaTeX Error: Cannot determine size
of graphic in `convert
figures/filename.gif 'png:-' (no size
specifed).


So, I added a bounding box manually to the includegraphics command:



includegraphics[0,0][18,18]{figures/filename.gif}


I got the dimensions using imagemagick's identify command.



I am able to convert the file, write it to a new file, and view it using imagemagick:



$ convert figures/filename.gif gif:figures/filename.png


I believe that the "convert" command I specified in the graphics rule is not actually running. What am I doing wrong?



Here are some details about my build:



$ pdflatex test.tex
This is pdfTeX, Version 3.14159-14h-released-20010417 (Web2C 7.3.3.1)
(./test.tex{pdftex.cfg}
LaTeX2e <2001/06/01>
Babel <v3.7h> and hyphenation patterns for american, french, german, ngerman, i
talian, nohyphenation, loaded.
(/usr/share/texmf/tex/latex/base/article.cls
Document Class: article 2001/04/21 v1.4e Standard LaTeX document class
(/usr/share/texmf/tex/latex/base/size10.clo))
(/usr/share/texmf/tex/latex/tools/verbatim.sty)
(/usr/share/texmf/tex/latex/fancyhdr/fancyhdr.sty)
(/usr/share/texmf/tex/latex/graphics/graphicx.sty
(/usr/share/texmf/tex/latex/graphics/keyval.sty)
(/usr/share/texmf/tex/latex/graphics/graphics.sty
(/usr/share/texmf/tex/latex/graphics/trig.sty)
(/usr/share/texmf/tex/latex/config/graphics.cfg)
(/usr/share/texmf/tex/latex/graphics/pdftex.def)))
(/usr/share/texmf/tex/latex/base/makeidx.sty)
Writing index file test.idx
(/usr/share/texmf/tex/latex/misc/pslatex.sty)
(/usr/share/texmf/tex/latex/pdfpages/pdfpages.sty
(/usr/share/texmf/tex/latex/base/ifthen.sty)
(/usr/share/texmf/tex/latex/tools/calc.sty)
(/usr/share/texmf/tex/latex/ms/eso-pic.sty
(/usr/share/texmf/tex/latex/ms/everyshi.sty))))

LaTeX Warning: Unused global option(s):
[8pt,english].

No file test.aux.
(/usr/share/texmf/tex/latex/psnfss/omspzccm.fd)
(/usr/share/texmf/tex/context/base/supp-pdf.tex
(/usr/share/texmf/tex/context/base/supp-mis.tex
loading : Context Support Macros / Missing
)
loading : Context Support Macros / PDF
) (/usr/share/texmf/tex/latex/psnfss/ot1ptmcm.fd)
(/usr/share/texmf/tex/latex/psnfss/omlptmcm.fd)
(/usr/share/texmf/tex/latex/psnfss/omxpsycm.fd)
<use `convert figures/remconf_edit.gif 'png:-'> [1{/usr/share/texmf/dvips/confi
g/pdftex.map}] (/usr/share/texmf/tex/latex/psnfss/omsphv.fd) [2] [3] [4]
(./test.aux) )</usr/share/texmf/fonts/type1/bluesky/cm/cmsy10.pfb>{/usr/share/t
exmf/dvips/base/8r.enc}






conversion graphics gif






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 21 at 12:19









Martin Scharrer

202k47646821




202k47646821










asked Nov 5 '10 at 19:24









AmyAmy

81113




81113













  • Can't you dump converted images into another folder? Do you absolutely have to grab them from the read-only folder where they are now?

    – ajeh
    Feb 5 '14 at 18:51



















  • Can't you dump converted images into another folder? Do you absolutely have to grab them from the read-only folder where they are now?

    – ajeh
    Feb 5 '14 at 18:51

















Can't you dump converted images into another folder? Do you absolutely have to grab them from the read-only folder where they are now?

– ajeh
Feb 5 '14 at 18:51





Can't you dump converted images into another folder? Do you absolutely have to grab them from the read-only folder where they are now?

– ajeh
Feb 5 '14 at 18:51










5 Answers
5






active

oldest

votes


















15














You need to enable shell escapes. With MiKTeX you do -enable-write18 and with TeXlive -shell-escape.



You can set up different conversion rules with the epstopdf package



documentclass{article}
usepackage{graphicx}
usepackage{epstopdf}
epstopdfDeclareGraphicsRule
{.gif}{png}{.png}{convert gif:SourceFile.SourceExt png:OutputFile}
AppendGraphicsExtensions{.gif}


begin{document}

includegraphics{test.gif}

end{document}


Using epstopdf you can control if the conversion should be done every time you compile or only if the target file is missing.






share|improve this answer


























  • I think the correct name of the option under TeX Live is -shell-escape.

    – mpg
    Nov 6 '10 at 0:16











  • Yes. I have corrected the answer.

    – Martin Heller
    Nov 6 '10 at 0:21











  • Thank you for this great example of how to use epstopdf to accomplish this image conversion.

    – Amy
    Nov 8 '10 at 14:54











  • --shell-escape actually seems to work in both TeX Live and MiKTeX now -- most likely also with just one dash. See this blog post of Joseph Wright's that Matthew Leingang linked to in his answer.

    – SamB
    Dec 31 '10 at 18:28



















8














DeclareGraphicsRule requires the write18 stream to be enabled in order to talk to the operating system. Ordinarily this is disabled because it can be dangerous. Try the same source file with pdflatex --shell-escape test.tex instead. See Joseph Wright's blog post about enabling write18.



On my machine if includegraphics{dir/foo.gif} is encountered and DeclareGraphicsRule{.gif}{png}... is declared, LaTeX (1) runs the command; then (2) looks for a file dir/foo_gif-converted-to.png So the graphics rule has to do that. You could use



DeclareGraphicsRule{.gif}{png}{.png}{`convert #1 `dirname #1`/`basename #1 .gif`-gif-converted-to.png}


But that will write to the same directory the file is originally in. You said you are importing files from a different directory that you do not have write access to. So instead do



DeclareGraphicsRule{.gif}{png}{.png}{`convert #1 `basename #1 .gif`-gif-converted-to.png}


So the file will be written into the document's directory. But now it won't be in dir/ anymore! So make sure that dir/ is in the TEXINPUTS path (or graphicspath) and just input it as foo.gif. LaTeX will (0) find foo.gif in dir/ (1) convert to ./foo_gif-converted-to.png, (2) find foo_gif-converted-to.png in the current directory.



Your graphics rule and question title indicate you want to do with using the output stream; that is, not create the converted files. I couldn't get that to work. The side effect is that you have a lot of ugly-titled converted files in your document's directory, and maybe you should have just done that in the first place with a script rather than through LaTeX.






share|improve this answer


























  • Thank you for your reply. The shell escape produced some additional log output, but I do not see any graphics in the output file.

    – Amy
    Nov 5 '10 at 20:54











  • Do you have a working example of DeclareGraphicsRule. I tried converting to pdf, eps, and png. When I use eps, I see some output to the sreen. I see an outline the size of the image and also the text (which appears in the graphics rule) `convert figures/figure.gif 'eps:-' .

    – Amy
    Nov 5 '10 at 21:00











  • @Amy: see edits

    – Matthew Leingang
    Nov 6 '10 at 21:09











  • Thank you for your insight into this problem. I especially appreciate you trying that the graphics rule. I can definitely solve this issue outside latex, but I really wanted to exhaust all the terrific features within latex first. Thanks a lot for your time.

    – Amy
    Nov 8 '10 at 14:52



















5














This is not a "pure" LaTeX answer but....



Do the convert magic in a script you run before you run pdflatex, that can be called from your makefile (if you use it)



#!/bin/bash 

cd figures

for f in *.gif ;
do
convert "$f" "${f/%gif/png}"
done


Now you have converted all the gif:s in dir figures into png:s.



Then you just include them as normal png:s.






share|improve this answer


























  • Any answer that uses purely latex is going to be wrong. Use the right tool for the job--in this case a shell script.

    – nimish
    Nov 7 '10 at 7:19











  • Thank you very much for taking the time to reply to my post.

    – Amy
    Nov 8 '10 at 14:53



















3














This works with latex:



documentclass[a4paper]{article}
usepackage{graphicx}
DeclareGraphicsRule{.JPG}{eps}{.JPG}{`convert #1 eps:-}
begin{document}
framebox{includegraphics[0,0][150,200]{DSC00121-SMALL.JPG}}
end{document}


in this way:





  • latex --shell-escape ... founds JPG file and puts an instruction into dvi file how to process JPG and what to include in page


  • dvips -R0 ... actually launches external command and includes output into a page,

  • ps file can be converted into pdf using ps2pdf


So, it does work on the fly and does not create "intermediate" files. This is how it should be --- all is well. This is how i managed to ask latex to downsample eps graphics before including them --- for downloadable pdf document:



documentclass[a4paper]{article}
usepackage{graphicx}
DeclareGraphicsRule{.eps}{eps}{.eps}{`convert #1 -resample 72x72 eps:-}
begin{document}
framebox{includegraphics{DSC00121.eps}}
end{document}


Surely, i would like it to work with pdflatex, but for some reason i could not get it working. Sorry, i don't know what's wrong, i am using "plain" pstricks so far, that's why i have a little pdflatex experience.





By the way, this command may be used to insert compressed (eps) images instead of raw ones:



`convert -compress zip #1 -resample 72x72 eps2:-





share|improve this answer

































    0














    You could also convert the gif to a flash file (swf). This is better than keeping it as a gif, since Adobe Reader has compatibility by default, which improves accessibility. There are many free converters, such as Format Factory.



    Jens Nöckel gives a sample of how to insert a flash movie.






    share|improve this answer





















    • 2





      To me this doesn't really answer the question, since it doesn't provide a means to "convert GIF to XXX on the fly". Moreover, SWF may be supported by Adobe Reader, but is that the case across all PDF readers? If not, I don't think it makes it "more accessible" in that format.

      – Werner
      Feb 5 '14 at 18:21











    • You are correct about the compatability of SWF. Although it is compatible with Adobe Reader by default, most PDF readers cannot see the animations of SWF images. However, all PDF readers will pick up the thumbnail. Also, there is a program that runs on Unix command line called gif2swf that can convert the files on the fly.

      – Kemal Ahmed
      Feb 12 '14 at 16:14













    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "85"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f4979%2fconvert-gif-image-to-png-on-the-fly%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    5 Answers
    5






    active

    oldest

    votes








    5 Answers
    5






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    15














    You need to enable shell escapes. With MiKTeX you do -enable-write18 and with TeXlive -shell-escape.



    You can set up different conversion rules with the epstopdf package



    documentclass{article}
    usepackage{graphicx}
    usepackage{epstopdf}
    epstopdfDeclareGraphicsRule
    {.gif}{png}{.png}{convert gif:SourceFile.SourceExt png:OutputFile}
    AppendGraphicsExtensions{.gif}


    begin{document}

    includegraphics{test.gif}

    end{document}


    Using epstopdf you can control if the conversion should be done every time you compile or only if the target file is missing.






    share|improve this answer


























    • I think the correct name of the option under TeX Live is -shell-escape.

      – mpg
      Nov 6 '10 at 0:16











    • Yes. I have corrected the answer.

      – Martin Heller
      Nov 6 '10 at 0:21











    • Thank you for this great example of how to use epstopdf to accomplish this image conversion.

      – Amy
      Nov 8 '10 at 14:54











    • --shell-escape actually seems to work in both TeX Live and MiKTeX now -- most likely also with just one dash. See this blog post of Joseph Wright's that Matthew Leingang linked to in his answer.

      – SamB
      Dec 31 '10 at 18:28
















    15














    You need to enable shell escapes. With MiKTeX you do -enable-write18 and with TeXlive -shell-escape.



    You can set up different conversion rules with the epstopdf package



    documentclass{article}
    usepackage{graphicx}
    usepackage{epstopdf}
    epstopdfDeclareGraphicsRule
    {.gif}{png}{.png}{convert gif:SourceFile.SourceExt png:OutputFile}
    AppendGraphicsExtensions{.gif}


    begin{document}

    includegraphics{test.gif}

    end{document}


    Using epstopdf you can control if the conversion should be done every time you compile or only if the target file is missing.






    share|improve this answer


























    • I think the correct name of the option under TeX Live is -shell-escape.

      – mpg
      Nov 6 '10 at 0:16











    • Yes. I have corrected the answer.

      – Martin Heller
      Nov 6 '10 at 0:21











    • Thank you for this great example of how to use epstopdf to accomplish this image conversion.

      – Amy
      Nov 8 '10 at 14:54











    • --shell-escape actually seems to work in both TeX Live and MiKTeX now -- most likely also with just one dash. See this blog post of Joseph Wright's that Matthew Leingang linked to in his answer.

      – SamB
      Dec 31 '10 at 18:28














    15












    15








    15







    You need to enable shell escapes. With MiKTeX you do -enable-write18 and with TeXlive -shell-escape.



    You can set up different conversion rules with the epstopdf package



    documentclass{article}
    usepackage{graphicx}
    usepackage{epstopdf}
    epstopdfDeclareGraphicsRule
    {.gif}{png}{.png}{convert gif:SourceFile.SourceExt png:OutputFile}
    AppendGraphicsExtensions{.gif}


    begin{document}

    includegraphics{test.gif}

    end{document}


    Using epstopdf you can control if the conversion should be done every time you compile or only if the target file is missing.






    share|improve this answer















    You need to enable shell escapes. With MiKTeX you do -enable-write18 and with TeXlive -shell-escape.



    You can set up different conversion rules with the epstopdf package



    documentclass{article}
    usepackage{graphicx}
    usepackage{epstopdf}
    epstopdfDeclareGraphicsRule
    {.gif}{png}{.png}{convert gif:SourceFile.SourceExt png:OutputFile}
    AppendGraphicsExtensions{.gif}


    begin{document}

    includegraphics{test.gif}

    end{document}


    Using epstopdf you can control if the conversion should be done every time you compile or only if the target file is missing.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Nov 6 '10 at 0:19

























    answered Nov 5 '10 at 20:27









    Martin HellerMartin Heller

    9,50122852




    9,50122852













    • I think the correct name of the option under TeX Live is -shell-escape.

      – mpg
      Nov 6 '10 at 0:16











    • Yes. I have corrected the answer.

      – Martin Heller
      Nov 6 '10 at 0:21











    • Thank you for this great example of how to use epstopdf to accomplish this image conversion.

      – Amy
      Nov 8 '10 at 14:54











    • --shell-escape actually seems to work in both TeX Live and MiKTeX now -- most likely also with just one dash. See this blog post of Joseph Wright's that Matthew Leingang linked to in his answer.

      – SamB
      Dec 31 '10 at 18:28



















    • I think the correct name of the option under TeX Live is -shell-escape.

      – mpg
      Nov 6 '10 at 0:16











    • Yes. I have corrected the answer.

      – Martin Heller
      Nov 6 '10 at 0:21











    • Thank you for this great example of how to use epstopdf to accomplish this image conversion.

      – Amy
      Nov 8 '10 at 14:54











    • --shell-escape actually seems to work in both TeX Live and MiKTeX now -- most likely also with just one dash. See this blog post of Joseph Wright's that Matthew Leingang linked to in his answer.

      – SamB
      Dec 31 '10 at 18:28

















    I think the correct name of the option under TeX Live is -shell-escape.

    – mpg
    Nov 6 '10 at 0:16





    I think the correct name of the option under TeX Live is -shell-escape.

    – mpg
    Nov 6 '10 at 0:16













    Yes. I have corrected the answer.

    – Martin Heller
    Nov 6 '10 at 0:21





    Yes. I have corrected the answer.

    – Martin Heller
    Nov 6 '10 at 0:21













    Thank you for this great example of how to use epstopdf to accomplish this image conversion.

    – Amy
    Nov 8 '10 at 14:54





    Thank you for this great example of how to use epstopdf to accomplish this image conversion.

    – Amy
    Nov 8 '10 at 14:54













    --shell-escape actually seems to work in both TeX Live and MiKTeX now -- most likely also with just one dash. See this blog post of Joseph Wright's that Matthew Leingang linked to in his answer.

    – SamB
    Dec 31 '10 at 18:28





    --shell-escape actually seems to work in both TeX Live and MiKTeX now -- most likely also with just one dash. See this blog post of Joseph Wright's that Matthew Leingang linked to in his answer.

    – SamB
    Dec 31 '10 at 18:28











    8














    DeclareGraphicsRule requires the write18 stream to be enabled in order to talk to the operating system. Ordinarily this is disabled because it can be dangerous. Try the same source file with pdflatex --shell-escape test.tex instead. See Joseph Wright's blog post about enabling write18.



    On my machine if includegraphics{dir/foo.gif} is encountered and DeclareGraphicsRule{.gif}{png}... is declared, LaTeX (1) runs the command; then (2) looks for a file dir/foo_gif-converted-to.png So the graphics rule has to do that. You could use



    DeclareGraphicsRule{.gif}{png}{.png}{`convert #1 `dirname #1`/`basename #1 .gif`-gif-converted-to.png}


    But that will write to the same directory the file is originally in. You said you are importing files from a different directory that you do not have write access to. So instead do



    DeclareGraphicsRule{.gif}{png}{.png}{`convert #1 `basename #1 .gif`-gif-converted-to.png}


    So the file will be written into the document's directory. But now it won't be in dir/ anymore! So make sure that dir/ is in the TEXINPUTS path (or graphicspath) and just input it as foo.gif. LaTeX will (0) find foo.gif in dir/ (1) convert to ./foo_gif-converted-to.png, (2) find foo_gif-converted-to.png in the current directory.



    Your graphics rule and question title indicate you want to do with using the output stream; that is, not create the converted files. I couldn't get that to work. The side effect is that you have a lot of ugly-titled converted files in your document's directory, and maybe you should have just done that in the first place with a script rather than through LaTeX.






    share|improve this answer


























    • Thank you for your reply. The shell escape produced some additional log output, but I do not see any graphics in the output file.

      – Amy
      Nov 5 '10 at 20:54











    • Do you have a working example of DeclareGraphicsRule. I tried converting to pdf, eps, and png. When I use eps, I see some output to the sreen. I see an outline the size of the image and also the text (which appears in the graphics rule) `convert figures/figure.gif 'eps:-' .

      – Amy
      Nov 5 '10 at 21:00











    • @Amy: see edits

      – Matthew Leingang
      Nov 6 '10 at 21:09











    • Thank you for your insight into this problem. I especially appreciate you trying that the graphics rule. I can definitely solve this issue outside latex, but I really wanted to exhaust all the terrific features within latex first. Thanks a lot for your time.

      – Amy
      Nov 8 '10 at 14:52
















    8














    DeclareGraphicsRule requires the write18 stream to be enabled in order to talk to the operating system. Ordinarily this is disabled because it can be dangerous. Try the same source file with pdflatex --shell-escape test.tex instead. See Joseph Wright's blog post about enabling write18.



    On my machine if includegraphics{dir/foo.gif} is encountered and DeclareGraphicsRule{.gif}{png}... is declared, LaTeX (1) runs the command; then (2) looks for a file dir/foo_gif-converted-to.png So the graphics rule has to do that. You could use



    DeclareGraphicsRule{.gif}{png}{.png}{`convert #1 `dirname #1`/`basename #1 .gif`-gif-converted-to.png}


    But that will write to the same directory the file is originally in. You said you are importing files from a different directory that you do not have write access to. So instead do



    DeclareGraphicsRule{.gif}{png}{.png}{`convert #1 `basename #1 .gif`-gif-converted-to.png}


    So the file will be written into the document's directory. But now it won't be in dir/ anymore! So make sure that dir/ is in the TEXINPUTS path (or graphicspath) and just input it as foo.gif. LaTeX will (0) find foo.gif in dir/ (1) convert to ./foo_gif-converted-to.png, (2) find foo_gif-converted-to.png in the current directory.



    Your graphics rule and question title indicate you want to do with using the output stream; that is, not create the converted files. I couldn't get that to work. The side effect is that you have a lot of ugly-titled converted files in your document's directory, and maybe you should have just done that in the first place with a script rather than through LaTeX.






    share|improve this answer


























    • Thank you for your reply. The shell escape produced some additional log output, but I do not see any graphics in the output file.

      – Amy
      Nov 5 '10 at 20:54











    • Do you have a working example of DeclareGraphicsRule. I tried converting to pdf, eps, and png. When I use eps, I see some output to the sreen. I see an outline the size of the image and also the text (which appears in the graphics rule) `convert figures/figure.gif 'eps:-' .

      – Amy
      Nov 5 '10 at 21:00











    • @Amy: see edits

      – Matthew Leingang
      Nov 6 '10 at 21:09











    • Thank you for your insight into this problem. I especially appreciate you trying that the graphics rule. I can definitely solve this issue outside latex, but I really wanted to exhaust all the terrific features within latex first. Thanks a lot for your time.

      – Amy
      Nov 8 '10 at 14:52














    8












    8








    8







    DeclareGraphicsRule requires the write18 stream to be enabled in order to talk to the operating system. Ordinarily this is disabled because it can be dangerous. Try the same source file with pdflatex --shell-escape test.tex instead. See Joseph Wright's blog post about enabling write18.



    On my machine if includegraphics{dir/foo.gif} is encountered and DeclareGraphicsRule{.gif}{png}... is declared, LaTeX (1) runs the command; then (2) looks for a file dir/foo_gif-converted-to.png So the graphics rule has to do that. You could use



    DeclareGraphicsRule{.gif}{png}{.png}{`convert #1 `dirname #1`/`basename #1 .gif`-gif-converted-to.png}


    But that will write to the same directory the file is originally in. You said you are importing files from a different directory that you do not have write access to. So instead do



    DeclareGraphicsRule{.gif}{png}{.png}{`convert #1 `basename #1 .gif`-gif-converted-to.png}


    So the file will be written into the document's directory. But now it won't be in dir/ anymore! So make sure that dir/ is in the TEXINPUTS path (or graphicspath) and just input it as foo.gif. LaTeX will (0) find foo.gif in dir/ (1) convert to ./foo_gif-converted-to.png, (2) find foo_gif-converted-to.png in the current directory.



    Your graphics rule and question title indicate you want to do with using the output stream; that is, not create the converted files. I couldn't get that to work. The side effect is that you have a lot of ugly-titled converted files in your document's directory, and maybe you should have just done that in the first place with a script rather than through LaTeX.






    share|improve this answer















    DeclareGraphicsRule requires the write18 stream to be enabled in order to talk to the operating system. Ordinarily this is disabled because it can be dangerous. Try the same source file with pdflatex --shell-escape test.tex instead. See Joseph Wright's blog post about enabling write18.



    On my machine if includegraphics{dir/foo.gif} is encountered and DeclareGraphicsRule{.gif}{png}... is declared, LaTeX (1) runs the command; then (2) looks for a file dir/foo_gif-converted-to.png So the graphics rule has to do that. You could use



    DeclareGraphicsRule{.gif}{png}{.png}{`convert #1 `dirname #1`/`basename #1 .gif`-gif-converted-to.png}


    But that will write to the same directory the file is originally in. You said you are importing files from a different directory that you do not have write access to. So instead do



    DeclareGraphicsRule{.gif}{png}{.png}{`convert #1 `basename #1 .gif`-gif-converted-to.png}


    So the file will be written into the document's directory. But now it won't be in dir/ anymore! So make sure that dir/ is in the TEXINPUTS path (or graphicspath) and just input it as foo.gif. LaTeX will (0) find foo.gif in dir/ (1) convert to ./foo_gif-converted-to.png, (2) find foo_gif-converted-to.png in the current directory.



    Your graphics rule and question title indicate you want to do with using the output stream; that is, not create the converted files. I couldn't get that to work. The side effect is that you have a lot of ugly-titled converted files in your document's directory, and maybe you should have just done that in the first place with a script rather than through LaTeX.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Nov 6 '10 at 21:09

























    answered Nov 5 '10 at 20:17









    Matthew LeingangMatthew Leingang

    35.2k10107178




    35.2k10107178













    • Thank you for your reply. The shell escape produced some additional log output, but I do not see any graphics in the output file.

      – Amy
      Nov 5 '10 at 20:54











    • Do you have a working example of DeclareGraphicsRule. I tried converting to pdf, eps, and png. When I use eps, I see some output to the sreen. I see an outline the size of the image and also the text (which appears in the graphics rule) `convert figures/figure.gif 'eps:-' .

      – Amy
      Nov 5 '10 at 21:00











    • @Amy: see edits

      – Matthew Leingang
      Nov 6 '10 at 21:09











    • Thank you for your insight into this problem. I especially appreciate you trying that the graphics rule. I can definitely solve this issue outside latex, but I really wanted to exhaust all the terrific features within latex first. Thanks a lot for your time.

      – Amy
      Nov 8 '10 at 14:52



















    • Thank you for your reply. The shell escape produced some additional log output, but I do not see any graphics in the output file.

      – Amy
      Nov 5 '10 at 20:54











    • Do you have a working example of DeclareGraphicsRule. I tried converting to pdf, eps, and png. When I use eps, I see some output to the sreen. I see an outline the size of the image and also the text (which appears in the graphics rule) `convert figures/figure.gif 'eps:-' .

      – Amy
      Nov 5 '10 at 21:00











    • @Amy: see edits

      – Matthew Leingang
      Nov 6 '10 at 21:09











    • Thank you for your insight into this problem. I especially appreciate you trying that the graphics rule. I can definitely solve this issue outside latex, but I really wanted to exhaust all the terrific features within latex first. Thanks a lot for your time.

      – Amy
      Nov 8 '10 at 14:52

















    Thank you for your reply. The shell escape produced some additional log output, but I do not see any graphics in the output file.

    – Amy
    Nov 5 '10 at 20:54





    Thank you for your reply. The shell escape produced some additional log output, but I do not see any graphics in the output file.

    – Amy
    Nov 5 '10 at 20:54













    Do you have a working example of DeclareGraphicsRule. I tried converting to pdf, eps, and png. When I use eps, I see some output to the sreen. I see an outline the size of the image and also the text (which appears in the graphics rule) `convert figures/figure.gif 'eps:-' .

    – Amy
    Nov 5 '10 at 21:00





    Do you have a working example of DeclareGraphicsRule. I tried converting to pdf, eps, and png. When I use eps, I see some output to the sreen. I see an outline the size of the image and also the text (which appears in the graphics rule) `convert figures/figure.gif 'eps:-' .

    – Amy
    Nov 5 '10 at 21:00













    @Amy: see edits

    – Matthew Leingang
    Nov 6 '10 at 21:09





    @Amy: see edits

    – Matthew Leingang
    Nov 6 '10 at 21:09













    Thank you for your insight into this problem. I especially appreciate you trying that the graphics rule. I can definitely solve this issue outside latex, but I really wanted to exhaust all the terrific features within latex first. Thanks a lot for your time.

    – Amy
    Nov 8 '10 at 14:52





    Thank you for your insight into this problem. I especially appreciate you trying that the graphics rule. I can definitely solve this issue outside latex, but I really wanted to exhaust all the terrific features within latex first. Thanks a lot for your time.

    – Amy
    Nov 8 '10 at 14:52











    5














    This is not a "pure" LaTeX answer but....



    Do the convert magic in a script you run before you run pdflatex, that can be called from your makefile (if you use it)



    #!/bin/bash 

    cd figures

    for f in *.gif ;
    do
    convert "$f" "${f/%gif/png}"
    done


    Now you have converted all the gif:s in dir figures into png:s.



    Then you just include them as normal png:s.






    share|improve this answer


























    • Any answer that uses purely latex is going to be wrong. Use the right tool for the job--in this case a shell script.

      – nimish
      Nov 7 '10 at 7:19











    • Thank you very much for taking the time to reply to my post.

      – Amy
      Nov 8 '10 at 14:53
















    5














    This is not a "pure" LaTeX answer but....



    Do the convert magic in a script you run before you run pdflatex, that can be called from your makefile (if you use it)



    #!/bin/bash 

    cd figures

    for f in *.gif ;
    do
    convert "$f" "${f/%gif/png}"
    done


    Now you have converted all the gif:s in dir figures into png:s.



    Then you just include them as normal png:s.






    share|improve this answer


























    • Any answer that uses purely latex is going to be wrong. Use the right tool for the job--in this case a shell script.

      – nimish
      Nov 7 '10 at 7:19











    • Thank you very much for taking the time to reply to my post.

      – Amy
      Nov 8 '10 at 14:53














    5












    5








    5







    This is not a "pure" LaTeX answer but....



    Do the convert magic in a script you run before you run pdflatex, that can be called from your makefile (if you use it)



    #!/bin/bash 

    cd figures

    for f in *.gif ;
    do
    convert "$f" "${f/%gif/png}"
    done


    Now you have converted all the gif:s in dir figures into png:s.



    Then you just include them as normal png:s.






    share|improve this answer















    This is not a "pure" LaTeX answer but....



    Do the convert magic in a script you run before you run pdflatex, that can be called from your makefile (if you use it)



    #!/bin/bash 

    cd figures

    for f in *.gif ;
    do
    convert "$f" "${f/%gif/png}"
    done


    Now you have converted all the gif:s in dir figures into png:s.



    Then you just include them as normal png:s.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Feb 5 '14 at 18:34









    doncherry

    35.1k23135208




    35.1k23135208










    answered Nov 6 '10 at 8:33









    JohanJohan

    1,62431420




    1,62431420













    • Any answer that uses purely latex is going to be wrong. Use the right tool for the job--in this case a shell script.

      – nimish
      Nov 7 '10 at 7:19











    • Thank you very much for taking the time to reply to my post.

      – Amy
      Nov 8 '10 at 14:53



















    • Any answer that uses purely latex is going to be wrong. Use the right tool for the job--in this case a shell script.

      – nimish
      Nov 7 '10 at 7:19











    • Thank you very much for taking the time to reply to my post.

      – Amy
      Nov 8 '10 at 14:53

















    Any answer that uses purely latex is going to be wrong. Use the right tool for the job--in this case a shell script.

    – nimish
    Nov 7 '10 at 7:19





    Any answer that uses purely latex is going to be wrong. Use the right tool for the job--in this case a shell script.

    – nimish
    Nov 7 '10 at 7:19













    Thank you very much for taking the time to reply to my post.

    – Amy
    Nov 8 '10 at 14:53





    Thank you very much for taking the time to reply to my post.

    – Amy
    Nov 8 '10 at 14:53











    3














    This works with latex:



    documentclass[a4paper]{article}
    usepackage{graphicx}
    DeclareGraphicsRule{.JPG}{eps}{.JPG}{`convert #1 eps:-}
    begin{document}
    framebox{includegraphics[0,0][150,200]{DSC00121-SMALL.JPG}}
    end{document}


    in this way:





    • latex --shell-escape ... founds JPG file and puts an instruction into dvi file how to process JPG and what to include in page


    • dvips -R0 ... actually launches external command and includes output into a page,

    • ps file can be converted into pdf using ps2pdf


    So, it does work on the fly and does not create "intermediate" files. This is how it should be --- all is well. This is how i managed to ask latex to downsample eps graphics before including them --- for downloadable pdf document:



    documentclass[a4paper]{article}
    usepackage{graphicx}
    DeclareGraphicsRule{.eps}{eps}{.eps}{`convert #1 -resample 72x72 eps:-}
    begin{document}
    framebox{includegraphics{DSC00121.eps}}
    end{document}


    Surely, i would like it to work with pdflatex, but for some reason i could not get it working. Sorry, i don't know what's wrong, i am using "plain" pstricks so far, that's why i have a little pdflatex experience.





    By the way, this command may be used to insert compressed (eps) images instead of raw ones:



    `convert -compress zip #1 -resample 72x72 eps2:-





    share|improve this answer






























      3














      This works with latex:



      documentclass[a4paper]{article}
      usepackage{graphicx}
      DeclareGraphicsRule{.JPG}{eps}{.JPG}{`convert #1 eps:-}
      begin{document}
      framebox{includegraphics[0,0][150,200]{DSC00121-SMALL.JPG}}
      end{document}


      in this way:





      • latex --shell-escape ... founds JPG file and puts an instruction into dvi file how to process JPG and what to include in page


      • dvips -R0 ... actually launches external command and includes output into a page,

      • ps file can be converted into pdf using ps2pdf


      So, it does work on the fly and does not create "intermediate" files. This is how it should be --- all is well. This is how i managed to ask latex to downsample eps graphics before including them --- for downloadable pdf document:



      documentclass[a4paper]{article}
      usepackage{graphicx}
      DeclareGraphicsRule{.eps}{eps}{.eps}{`convert #1 -resample 72x72 eps:-}
      begin{document}
      framebox{includegraphics{DSC00121.eps}}
      end{document}


      Surely, i would like it to work with pdflatex, but for some reason i could not get it working. Sorry, i don't know what's wrong, i am using "plain" pstricks so far, that's why i have a little pdflatex experience.





      By the way, this command may be used to insert compressed (eps) images instead of raw ones:



      `convert -compress zip #1 -resample 72x72 eps2:-





      share|improve this answer




























        3












        3








        3







        This works with latex:



        documentclass[a4paper]{article}
        usepackage{graphicx}
        DeclareGraphicsRule{.JPG}{eps}{.JPG}{`convert #1 eps:-}
        begin{document}
        framebox{includegraphics[0,0][150,200]{DSC00121-SMALL.JPG}}
        end{document}


        in this way:





        • latex --shell-escape ... founds JPG file and puts an instruction into dvi file how to process JPG and what to include in page


        • dvips -R0 ... actually launches external command and includes output into a page,

        • ps file can be converted into pdf using ps2pdf


        So, it does work on the fly and does not create "intermediate" files. This is how it should be --- all is well. This is how i managed to ask latex to downsample eps graphics before including them --- for downloadable pdf document:



        documentclass[a4paper]{article}
        usepackage{graphicx}
        DeclareGraphicsRule{.eps}{eps}{.eps}{`convert #1 -resample 72x72 eps:-}
        begin{document}
        framebox{includegraphics{DSC00121.eps}}
        end{document}


        Surely, i would like it to work with pdflatex, but for some reason i could not get it working. Sorry, i don't know what's wrong, i am using "plain" pstricks so far, that's why i have a little pdflatex experience.





        By the way, this command may be used to insert compressed (eps) images instead of raw ones:



        `convert -compress zip #1 -resample 72x72 eps2:-





        share|improve this answer















        This works with latex:



        documentclass[a4paper]{article}
        usepackage{graphicx}
        DeclareGraphicsRule{.JPG}{eps}{.JPG}{`convert #1 eps:-}
        begin{document}
        framebox{includegraphics[0,0][150,200]{DSC00121-SMALL.JPG}}
        end{document}


        in this way:





        • latex --shell-escape ... founds JPG file and puts an instruction into dvi file how to process JPG and what to include in page


        • dvips -R0 ... actually launches external command and includes output into a page,

        • ps file can be converted into pdf using ps2pdf


        So, it does work on the fly and does not create "intermediate" files. This is how it should be --- all is well. This is how i managed to ask latex to downsample eps graphics before including them --- for downloadable pdf document:



        documentclass[a4paper]{article}
        usepackage{graphicx}
        DeclareGraphicsRule{.eps}{eps}{.eps}{`convert #1 -resample 72x72 eps:-}
        begin{document}
        framebox{includegraphics{DSC00121.eps}}
        end{document}


        Surely, i would like it to work with pdflatex, but for some reason i could not get it working. Sorry, i don't know what's wrong, i am using "plain" pstricks so far, that's why i have a little pdflatex experience.





        By the way, this command may be used to insert compressed (eps) images instead of raw ones:



        `convert -compress zip #1 -resample 72x72 eps2:-






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Dec 30 '10 at 11:37

























        answered Dec 29 '10 at 12:13









        brownianbrownian

        41428




        41428























            0














            You could also convert the gif to a flash file (swf). This is better than keeping it as a gif, since Adobe Reader has compatibility by default, which improves accessibility. There are many free converters, such as Format Factory.



            Jens Nöckel gives a sample of how to insert a flash movie.






            share|improve this answer





















            • 2





              To me this doesn't really answer the question, since it doesn't provide a means to "convert GIF to XXX on the fly". Moreover, SWF may be supported by Adobe Reader, but is that the case across all PDF readers? If not, I don't think it makes it "more accessible" in that format.

              – Werner
              Feb 5 '14 at 18:21











            • You are correct about the compatability of SWF. Although it is compatible with Adobe Reader by default, most PDF readers cannot see the animations of SWF images. However, all PDF readers will pick up the thumbnail. Also, there is a program that runs on Unix command line called gif2swf that can convert the files on the fly.

              – Kemal Ahmed
              Feb 12 '14 at 16:14


















            0














            You could also convert the gif to a flash file (swf). This is better than keeping it as a gif, since Adobe Reader has compatibility by default, which improves accessibility. There are many free converters, such as Format Factory.



            Jens Nöckel gives a sample of how to insert a flash movie.






            share|improve this answer





















            • 2





              To me this doesn't really answer the question, since it doesn't provide a means to "convert GIF to XXX on the fly". Moreover, SWF may be supported by Adobe Reader, but is that the case across all PDF readers? If not, I don't think it makes it "more accessible" in that format.

              – Werner
              Feb 5 '14 at 18:21











            • You are correct about the compatability of SWF. Although it is compatible with Adobe Reader by default, most PDF readers cannot see the animations of SWF images. However, all PDF readers will pick up the thumbnail. Also, there is a program that runs on Unix command line called gif2swf that can convert the files on the fly.

              – Kemal Ahmed
              Feb 12 '14 at 16:14
















            0












            0








            0







            You could also convert the gif to a flash file (swf). This is better than keeping it as a gif, since Adobe Reader has compatibility by default, which improves accessibility. There are many free converters, such as Format Factory.



            Jens Nöckel gives a sample of how to insert a flash movie.






            share|improve this answer















            You could also convert the gif to a flash file (swf). This is better than keeping it as a gif, since Adobe Reader has compatibility by default, which improves accessibility. There are many free converters, such as Format Factory.



            Jens Nöckel gives a sample of how to insert a flash movie.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Feb 12 '14 at 16:17

























            answered Feb 5 '14 at 17:49









            Kemal AhmedKemal Ahmed

            393




            393








            • 2





              To me this doesn't really answer the question, since it doesn't provide a means to "convert GIF to XXX on the fly". Moreover, SWF may be supported by Adobe Reader, but is that the case across all PDF readers? If not, I don't think it makes it "more accessible" in that format.

              – Werner
              Feb 5 '14 at 18:21











            • You are correct about the compatability of SWF. Although it is compatible with Adobe Reader by default, most PDF readers cannot see the animations of SWF images. However, all PDF readers will pick up the thumbnail. Also, there is a program that runs on Unix command line called gif2swf that can convert the files on the fly.

              – Kemal Ahmed
              Feb 12 '14 at 16:14
















            • 2





              To me this doesn't really answer the question, since it doesn't provide a means to "convert GIF to XXX on the fly". Moreover, SWF may be supported by Adobe Reader, but is that the case across all PDF readers? If not, I don't think it makes it "more accessible" in that format.

              – Werner
              Feb 5 '14 at 18:21











            • You are correct about the compatability of SWF. Although it is compatible with Adobe Reader by default, most PDF readers cannot see the animations of SWF images. However, all PDF readers will pick up the thumbnail. Also, there is a program that runs on Unix command line called gif2swf that can convert the files on the fly.

              – Kemal Ahmed
              Feb 12 '14 at 16:14










            2




            2





            To me this doesn't really answer the question, since it doesn't provide a means to "convert GIF to XXX on the fly". Moreover, SWF may be supported by Adobe Reader, but is that the case across all PDF readers? If not, I don't think it makes it "more accessible" in that format.

            – Werner
            Feb 5 '14 at 18:21





            To me this doesn't really answer the question, since it doesn't provide a means to "convert GIF to XXX on the fly". Moreover, SWF may be supported by Adobe Reader, but is that the case across all PDF readers? If not, I don't think it makes it "more accessible" in that format.

            – Werner
            Feb 5 '14 at 18:21













            You are correct about the compatability of SWF. Although it is compatible with Adobe Reader by default, most PDF readers cannot see the animations of SWF images. However, all PDF readers will pick up the thumbnail. Also, there is a program that runs on Unix command line called gif2swf that can convert the files on the fly.

            – Kemal Ahmed
            Feb 12 '14 at 16:14







            You are correct about the compatability of SWF. Although it is compatible with Adobe Reader by default, most PDF readers cannot see the animations of SWF images. However, all PDF readers will pick up the thumbnail. Also, there is a program that runs on Unix command line called gif2swf that can convert the files on the fly.

            – Kemal Ahmed
            Feb 12 '14 at 16:14




















            draft saved

            draft discarded




















































            Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f4979%2fconvert-gif-image-to-png-on-the-fly%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

            ComboBox Display Member on multiple fields

            Is it possible to collect Nectar points via Trainline?