Hi all,
I have made some progress on this question via google, but I have gotten stuck.
My goal is to convert a multipage PDF file into an animated gif.
I have done this successfully with:
convert -delay 20 stochastic_maps_DEC_vs_DECj_M3_v1_WORKED_ARCHIVE_yes_dotted_lines.pdf stochastic_maps_DEC_vs_DECj_M3_v1_WORKED_ARCHIVE_yes_dotted_lines.gif
...however, the images (which are 12" wide x 6" tall in the PDF, and looks good as a vector image in the PDF) come out blurry under this command, and also the image displays in a browser as rather small (perhaps 6" wide, yes I clicked the zoom option to make sure it wasn't some preview).
In an attempt to produce a bigger, and higher resolution, image, I tried:
convert -delay 20 -extent 1200x600 stochastic_maps_DEC_vs_DECj_M3_v1_WORKED_ARCHIVE_yes_dotted_lines.pdf stochastic_maps_DEC_vs_DECj_M3_v1_WORKED_ARCHIVE_yes_dotted_lines_larger.gif
...this improved the resolution nicely, but the image display size is the same.
I then tried various combinations of "-resize" and "-extent", but it appears that I can only increase the size, or the resolution, but not both. E.g.:
convert -delay 20 -background white -resize '150%' -extent '3200x1600<' -background white stochastic_maps_DEC_vs_DECj_M3_v1_WORKED_ARCHIVE_yes_dotted_lines.pdf stochastic_maps_DEC_vs_DECj_M3_v1_WORKED_ARCHIVE_yes_dotted_lines_larger5.gif
...the image is now a good size, but still blurry. Higher values for -extent produce "malloc" errors. I would try troubleshooting these, maybe there is a way to increase memory, but I'm not even sure I'm "doing it right" to start.
UPDATE: Actually, this is (almost) the right size and resolution:
convert -delay 20 -background white -resize '150%' -density 144x144 -background white stochastic_maps_DEC_vs_DECj_M3_v1_WORKED_ARCHIVE_yes_dotted_lines.pdf stochastic_maps_DEC_vs_DECj_M3_v1_WORKED_ARCHIVE_yes_dotted_lines_larger6.gif
...however, now I am getting an issue where it looks like many of the gifs in the animation are writing on top of each other, rather than completely clearing the previous image and writing a new one, which is what I want. Strangely, I only saw this sometimes in the previous runs, and I can't find a pattern to which commands are causing this problem.
Any help very much appreciated here or via email! Cheers!
Nick
matzke@nimbios.org
convert multipage PDF to high-resolution animated gif
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: convert multipage PDF to high-resolution animated gif
The cure is probably "-density X" before reading the PDF, where X is a suitable number. I suggest you get this correct, and don't do "-resize" or "-extent".matzke wrote:... come out blurry under this command, and also the image displays in a browser as rather small ...
The cure may be "-layers coalesce" before writing the GIF, but I'm not an animation expert.matzke wrote:... many of the gifs in the animation are writing on top of each other ...
snibgo's IM pages: im.snibgo.com
Re: convert multipage PDF to high-resolution animated gif
Thanks! The tip about -density being all that was needed helped.
The images-overwriting-each-other problem was solved with -dispose. So, this command does everything I wanted to convert a multipage PDF to a nice big high-resolution animated gif:
# -dispose option should help
# http://www.alecjacobson.com/weblog/?p=2601
convert -delay 20 -density 200x200 -dispose previous stochastic_maps_DEC_vs_DECj_M3_v1_WORKED_ARCHIVE_yes_dotted_lines.pdf -layers coalesce stochastic_maps_DEC_vs_DECj_M3_v1_WORKED_ARCHIVE_yes_dotted_lines_larger7.gif
Thanks!!!!!!
Nick
The images-overwriting-each-other problem was solved with -dispose. So, this command does everything I wanted to convert a multipage PDF to a nice big high-resolution animated gif:
# -dispose option should help
# http://www.alecjacobson.com/weblog/?p=2601
convert -delay 20 -density 200x200 -dispose previous stochastic_maps_DEC_vs_DECj_M3_v1_WORKED_ARCHIVE_yes_dotted_lines.pdf -layers coalesce stochastic_maps_DEC_vs_DECj_M3_v1_WORKED_ARCHIVE_yes_dotted_lines_larger7.gif
Thanks!!!!!!
Nick
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: convert multipage PDF to high-resolution animated gif
You might try the following. It might make the gif animation smaller
convert -delay 20 -density 200x200 -dispose previous stochastic_maps_DEC_vs_DECj_M3_v1_WORKED_ARCHIVE_yes_dotted_lines.pdf -coalesce -layers optimize stochastic_maps_DEC_vs_DECj_M3_v1_WORKED_ARCHIVE_yes_dotted_lines_larger7.gif
You might also want to add -loop X, where X=0 is loop forever
Note here it is just -coalesce and not -layers coalesce
convert -delay 20 -density 200x200 -dispose previous stochastic_maps_DEC_vs_DECj_M3_v1_WORKED_ARCHIVE_yes_dotted_lines.pdf -coalesce -layers optimize stochastic_maps_DEC_vs_DECj_M3_v1_WORKED_ARCHIVE_yes_dotted_lines_larger7.gif
You might also want to add -loop X, where X=0 is loop forever
Note here it is just -coalesce and not -layers coalesce
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: convert multipage PDF to high-resolution animated gif
I should add (before Fred does) that using "-resize" after "-density" can be useful, eg using "-density" twice as large as needed then "-resize 50%". This is known as supersampling. However, I think it's best to find the correct "-density" first, then supersample if needed.
snibgo's IM pages: im.snibgo.com
Re: convert multipage PDF to high-resolution animated gif
Thanks for the suggestions! I tried:
convert -delay 20 -density 100x100 -dispose previous stochastic_maps_DEC_vs_DECj_M3_v1_WORKED_ARCHIVE_yes_dotted_lines.pdf -coalesce -layers optimize stochastic_maps_DEC_vs_DECj_M3_v1_WORKED_ARCHIVE_yes_dotted_lines_100dpi_optimized.gif
...the result is a filesize 4 times smaller, but it looks kind of screwy:
http://phylo.wdfiles.com/local--files/b ... imized.gif
If anyone's interested, here are the animated GIFs that look good:
http://phylo.wikidot.com/biogeobears#toc0
Cheers!
Nick
convert -delay 20 -density 100x100 -dispose previous stochastic_maps_DEC_vs_DECj_M3_v1_WORKED_ARCHIVE_yes_dotted_lines.pdf -coalesce -layers optimize stochastic_maps_DEC_vs_DECj_M3_v1_WORKED_ARCHIVE_yes_dotted_lines_100dpi_optimized.gif
...the result is a filesize 4 times smaller, but it looks kind of screwy:
http://phylo.wdfiles.com/local--files/b ... imized.gif
If anyone's interested, here are the animated GIFs that look good:
http://phylo.wikidot.com/biogeobears#toc0
Cheers!
Nick
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: convert multipage PDF to high-resolution animated gif
try changing or removing the dispose method. or try -layers coalesce -layers optimize
see http://www.imagemagick.org/Usage/anim_basics/#dispose
if all fails to help, you can post your pdf to dropbox.com (public folder) and post the url here.
see http://www.imagemagick.org/Usage/anim_basics/#dispose
if all fails to help, you can post your pdf to dropbox.com (public folder) and post the url here.
Re: convert multipage PDF to high-resolution animated gif
I've tried several variants with -layers optimize, -previous, etc., but I can't get something that looks good. Making a smaller file size is not very important in my case, I'm quite happy with what this produced:
convert -delay 20 -density 200x200 -dispose previous stochastic_maps_DEC_vs_DECj_M3_v1_WORKED_ARCHIVE_yes_dotted_lines.pdf -layers coalesce stochastic_maps_DEC_vs_DECj_M3_v1_WORKED_ARCHIVE_yes_dotted_lines_larger7.gif
Which is here:
http://phylo.wikidot.com/biogeobears#toc0
Thanks for your help! Cheers, Nick
convert -delay 20 -density 200x200 -dispose previous stochastic_maps_DEC_vs_DECj_M3_v1_WORKED_ARCHIVE_yes_dotted_lines.pdf -layers coalesce stochastic_maps_DEC_vs_DECj_M3_v1_WORKED_ARCHIVE_yes_dotted_lines_larger7.gif
Which is here:
http://phylo.wikidot.com/biogeobears#toc0
Thanks for your help! Cheers, Nick