converting to pdf all gifs

Franz Waldmüller waldbauernbub at gmx.at
Thu Dec 16 20:13:08 UTC 2010


Am 2010-12-14 16:35, schrieb Smoot Carl-Mitchell:
> On Tue, 2010-12-14 at 20:55 +0530, Tapas Mishra wrote:
>> I am having 982 images which are in gif format.This is basically a
>> document which is in form of gifs.
>> I want to create one pdf all these 982 are numbered sequentially.So in
>> the pdf I want them from gif1 to gif982 all in one pdf.
>> I read some where imagemagick can do this.Or inserting image in
>> openoffice and then saving as pdf as an option.
>> But to insert  982 gifs it would be difficult.So is there an easy way
>> to do so?
>
> ImageMagick can do it.  Something like:
>
> convert gif* out.pdf
>
> should do the trick.  You may have to fiddle with the input file naming
> to get the sort order correct.
>
your gifs are numbered sequentially - perfect!
install imagemagick and pdftk
sudo apt-get install imagemagick pdftk

copy the following into a text editor

#!/bin/bash
for file in *gif
do
	convert $file $file.pdf
done
pdftk *.pdf cat output finalpdf.pdf # merge all pdf files into one 
single pdf file.

#############

save the file as "convert.sh" into the folder where the gives which 
should be converted are stored. Make sure that in this folder contains 
only your gif files and the script which you just stored within.

open up a terminal and paste the following commands (adjust them to your 
needs.

cd /home/tapas/folder-with-gifs 	# change your working directory
chmod u+x convert.sh			# make the script executable
./convert.sh				# run the script

I hope this helps
Franz




More information about the ubuntu-users mailing list