command cat

Asked by giovanni

I have 4 jpg files, id est 1.jpg, 2. jpg etc.
If I type "cat *.jpg > x.jpg" the first page is duplicated and appears twice, at the beginning and at the end of the document.
Can you help me?

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu gnome-terminal Edit question
Assignee:
No assignee Edit question
Solved by:
mycae
Solved:
Last query:
Last reply:
Revision history for this message
Best mycae (mycae) said :
#1

What are you trying to do? Doing that will simply append each JPEG to one another at the binary level, which will probably create a big binary mess.

Are you trying to create a single file to send to someone? In that case you can either
1) zip them up in an archive (tar -cz *.jpg > my-archive.tar.gz)
2) make a multipage document, such as a PDF. To do this install ImageMagick, to get the "convert" tool, then "convert *.jpg my-pdf.pdf"

Revision history for this message
giovanni (giolombardo) said :
#2

I am trying to unite the single files.
I have already tried to do make a multipage document by converting it, but only the first page is A4 format, the others are "thumbnails"

Revision history for this message
giovanni (giolombardo) said :
#3

I am trying to unite the single files.
I have already tried to do make a multipage document by converting it, but only the first page is A4 format, the others are "thumbnails"

Revision history for this message
mycae (mycae) said :
#4

I think you can add "-page A4" to force all pages to A4, otherwise it uses the JPEGs themselves to set the size.

You could also just do this in openoffice if you need finer control over the layout.

Revision history for this message
giovanni (giolombardo) said :
#5

will you please write the exact command? thanks

Revision history for this message
mycae (mycae) said :
#6

convert *jpg -page A4 test.pdf

the images were aligned to the left in the output PDF.

Revision history for this message
mycae (mycae) said :
#7

You can look up all of the options using the man page

http://man.cx/convert

or, from the terminal, simply type "man (COMMANDNAME)".

you can quit it with "q". There is a GUI browser for the manpages, but i forget what it is called.

Revision history for this message
giovanni (giolombardo) said :
#8

Thank you, Mycae, it works.