LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-18-2010, 10:44 AM   #1
janis_169
LQ Newbie
 
Registered: Jul 2010
Posts: 2

Rep: Reputation: 0
Using convert from imagemagick package to convert multiple jpg files


Hi!!!
I'm trying to use convert, I have installed the imagemagick.
I use this line:
convert *.jpg test.pdf
but I'm only able to convert to pdf 1 single jpg file, not multiple files at once. When there's more than one file, I get the following error:
Segmentation fault
Could anybody help me??
Thanks a lot, I'm really new at this
Janis
 
Old 07-18-2010, 11:02 AM   #2
Bruce Hill
HCL Maintainer
 
Registered: Jun 2003
Location: McCalla, AL, USA
Distribution: Arch, Gentoo
Posts: 6,940

Rep: Reputation: 129Reputation: 129
Not sure about any other method, but can you test this bash one liner,
maybe copying your files to a directory just to test this. So if it does
not work, you still have your original files as they are now.
Code:
for i in *.jpg; do convert "$i" "`basename "$i" .jpg`".pdf; done
In your example above, you would be asking for every file with .jpg as an
extension to be converted to one pdf file named test.pdf

Whereas "convert *.jpg *.pdf" would convert every file ending in .jpg to
it's corresponding name ending in .pdf -- either try this last example or
the bash one liner above. Either way, use a test directory with copied files
so you don't accidentally hose the originals.
 
Old 07-18-2010, 11:02 AM   #3
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
You command tries to convert all files ending in ".jpg" to "test.jpg". I don't think that's what you want.

Suppose you have 3 files:
peter.jpg
paul.jpg
mary.jpg

I would think you would want:
peter.pdf
paul.pdf
mary.pdf

If that's correct, then something like this should work (not tested):

Code:
for file in *jpg; do
    convert $name $(sed 's/\.jpg//' $name).pdf
done
Regardless, please confirm the "before and after" result you are looking for.
 
Old 07-18-2010, 11:04 AM   #4
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
((Bruce and I posted at the same time---as far as I can tell, both solutions will work.))
 
Old 07-18-2010, 03:28 PM   #5
janis_169
LQ Newbie
 
Registered: Jul 2010
Posts: 2

Original Poster
Rep: Reputation: 0
Hi, Bruce and Pixellany, I tried Bruce's bash line, and I succeeded to obtain each of the jpgs as a pdf files. As they belong to a book (I'm talking of about 1000 jpg files, and now 1000 pdf files), I would like to merge them together. How can I do that???
Thank you very much, again
Janis
 
Old 07-18-2010, 04:22 PM   #6
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
I think if you are merging a bunch of jpgs, pdfs, etc. you need to say something about how they are assembled.

For example, what is the size of the pictures and what it the page size that you want in the finished document?

Have you looked thru the ImageMagick documentation here?
http://www.imagemagick.org/script/index.php
Also search in Google for--eg--"pdf tools Linux"

Last edited by pixellany; 07-18-2010 at 04:23 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
convert multiple jpg files into pdf Brocolli Linux - Software 5 05-08-2013 09:43 AM
Using imagemagick to convert numerous jpg files to single pdf jrtayloriv Linux - Software 7 05-03-2013 05:13 AM
Convert multiple VOB files to one AVI mrant0 Linux - Software 2 05-26-2007 12:05 PM
HELP! BASH - Convert filenames from dsc00***.jpg to *.jpg jimmybond01 Programming 9 05-08-2007 06:17 AM
ImageMagick - convert cornish Linux - Software 3 06-13-2006 08:26 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:01 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration