Sort jpg according to creation date and convert to single pdf
On a Mac, how can I sort about 2400 jpg according to their creation date (i. e. stat -f %SB) via terminal and convert them in that order into one pdf?
What if one jpg has been created today at 11:10 pm and a second one shortly after within the same minute at 11:10 pm? Are there seconds in the creation date, which can be taken into account?
shell osx sort pdf jpeg
add a comment |
On a Mac, how can I sort about 2400 jpg according to their creation date (i. e. stat -f %SB) via terminal and convert them in that order into one pdf?
What if one jpg has been created today at 11:10 pm and a second one shortly after within the same minute at 11:10 pm? Are there seconds in the creation date, which can be taken into account?
shell osx sort pdf jpeg
You can do this easily withzsh(e.g. custom sorting). I don't have access to OSX so cannot post an answer but this should be piece of cake...
– don_crissti
Aug 5 '17 at 9:43
add a comment |
On a Mac, how can I sort about 2400 jpg according to their creation date (i. e. stat -f %SB) via terminal and convert them in that order into one pdf?
What if one jpg has been created today at 11:10 pm and a second one shortly after within the same minute at 11:10 pm? Are there seconds in the creation date, which can be taken into account?
shell osx sort pdf jpeg
On a Mac, how can I sort about 2400 jpg according to their creation date (i. e. stat -f %SB) via terminal and convert them in that order into one pdf?
What if one jpg has been created today at 11:10 pm and a second one shortly after within the same minute at 11:10 pm? Are there seconds in the creation date, which can be taken into account?
shell osx sort pdf jpeg
shell osx sort pdf jpeg
edited Feb 11 at 9:38
PRY
2,55831026
2,55831026
asked Jun 21 '17 at 21:10
Til HundTil Hund
9917
9917
You can do this easily withzsh(e.g. custom sorting). I don't have access to OSX so cannot post an answer but this should be piece of cake...
– don_crissti
Aug 5 '17 at 9:43
add a comment |
You can do this easily withzsh(e.g. custom sorting). I don't have access to OSX so cannot post an answer but this should be piece of cake...
– don_crissti
Aug 5 '17 at 9:43
You can do this easily with
zsh (e.g. custom sorting). I don't have access to OSX so cannot post an answer but this should be piece of cake...– don_crissti
Aug 5 '17 at 9:43
You can do this easily with
zsh (e.g. custom sorting). I don't have access to OSX so cannot post an answer but this should be piece of cake...– don_crissti
Aug 5 '17 at 9:43
add a comment |
3 Answers
3
active
oldest
votes
A simple command line with ImageMagick convert works for me.
I tested with the following command line (in a directory with 14 png files), and there will be one picture per page in the pdf file.
convert *.png out-parrot.pdf
But there can be problems with some versions of convert
It works as intended with the version of convert in Parrot 4.4
$convert --version
Version: ImageMagick 6.9.10-23 Q16 x86_64 20190101 https://imagemagick.org
but it does not work with the version of convert in Ubuntu 18.04.1 LTS (up to date in February 2019)
$ convert --version
Version: ImageMagick 6.9.7-4 Q16 x86_64 20170114 http://www.imagemagick.org
This version is 'not authorized' to write pdf files
$ convert *.png out-ubuntu.pdf
convert-im6.q16: not authorized `out-ubuntu.pdf' @ error/constitute.c/WriteImage/1037.
$ apt-cache policy imagemagick
imagemagick:
Installed: 8:6.9.7.4+dfsg-16ubuntu6.4
Candidate: 8:6.9.7.4+dfsg-16ubuntu6.4
Version table:
*** 8:6.9.7.4+dfsg-16ubuntu6.4 500
500 http://se.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
500 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages
100 /var/lib/dpkg/status
8:6.9.7.4+dfsg-16ubuntu6 500
500 http://se.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
Via an Ubuntu mailing list I had the following answer (that converting to pdf was turned off because of problems with ImageMagick vulnerabilities)
Is this a bug in ImageMagick convert, specifically for Ubuntu 18.04 LTS,
or is converting to pdf turned off by intention?
The change was intentional. See https://usn.ubuntu.com/3785-1/
Thanks, Jeremy Bicha
add a comment |
It depends on the filesystem. For example, on my host, I am using the fourth extended filesystem (ext4), and stat reports thusly for files:
$ touch foo; stat foo; rm foo
File: 'foo'
Size: 0 Blocks: 0 IO Block: 4096 regular empty file
Device: fc00h/64512d Inode: 262155 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 1000/ ownerusername) Gid: ( 1000/ ownerusername)
Access: 2017-06-21 14:28:16.150323827 -0700
Modify: 2017-06-21 14:28:16.150323827 -0700
Change: 2017-06-21 14:28:16.150323827 -0700
Birth: -
So you can use the last-modified time as create time is something of a misnomer.
find /path/to/images -type f -print0 -name *.jpg | xargs -0 stat -c "%y|%n" | sort | awk -F'|' '{print $2}'
This somewhat cumbersome construct will give you a list of files in order by last modification time (provided you have no files with | in their names).
Once you have and have reviewed this list, you can use Imagemagick's convert tool to assemble the PDF:
convert <<list of files>> outputfile.pdf
Or, to do it all at once:
convert $(find /path/to/images -type f -print0 -name *.jpg | xargs -0 stat -c "%y|%n" | sort | awk -F'|' '{print $2}') outputfile.pdf
The OP mentions nothing about parsing exif data, however.
– DopeGhoti
Jun 21 '17 at 21:51
DopeGhoti, thank you very much your reply. When I try the above command I get the following error messagestat: illegal option -- c. It is true, the picture I have do not have EXIF data.
– Til Hund
Jun 22 '17 at 20:17
Do you know which filesystem is in question here?stat -cworks for me in my tests.
– DopeGhoti
Jun 22 '17 at 20:31
I might add that I want to use the above command on a Mac. I did not mentioned it before as I thought it would be irrelevant to the question. The filesystem would beHFS PlusorMac OS Extended (Journaled).
– Til Hund
Jun 23 '17 at 8:04
For a Mac, usestat -f "%a|%N".
– DopeGhoti
Jun 28 '17 at 16:05
|
show 1 more comment
Install ImageMagick. Assuming the JPG images are in ~/images and the file names don't contain any spaces (nor any of [*?) and you have a directory ~/combined:
convert -combine -append $(ls -tr ~/images/*.jpg) ~/combined/all.jpg
or
convert -combine -append $(ls -tr ~/images/*.jpg) ~/combined/all.pdf
If the images are not the same size, you will get warnings. -append combines images top to bottom. Change to +append and images will combine left to right.
Time: Although ls -l shows time down to hour:minute, Linux keeps track of the access, modify, and age/change times down to the nano second I believe. So sorting by ls -tr does account for even fractions of seconds.
1
Don't parsels.
– DopeGhoti
Jun 21 '17 at 21:43
Thank you, Deathgrip, for answering. How can I convert the pictures into a single pdf as asked above?
– Til Hund
Jun 21 '17 at 21:43
@DopeGhoti - huh? the command works fine and I tested it using CentOS 7.
– Deathgrip
Jun 21 '17 at 21:46
It will fail if any of those file names contains[[:space:]]...
– don_crissti
Jun 21 '17 at 21:47
Trying to parse the output of anlsis an exercise which, while it may seem to work, is a terribly bad habit to get into for many many security-related reasons, which the link included in my answer goes into in great detail. More detail can be found here.
– DopeGhoti
Jun 21 '17 at 21:47
|
show 1 more comment
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f372578%2fsort-jpg-according-to-creation-date-and-convert-to-single-pdf%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
A simple command line with ImageMagick convert works for me.
I tested with the following command line (in a directory with 14 png files), and there will be one picture per page in the pdf file.
convert *.png out-parrot.pdf
But there can be problems with some versions of convert
It works as intended with the version of convert in Parrot 4.4
$convert --version
Version: ImageMagick 6.9.10-23 Q16 x86_64 20190101 https://imagemagick.org
but it does not work with the version of convert in Ubuntu 18.04.1 LTS (up to date in February 2019)
$ convert --version
Version: ImageMagick 6.9.7-4 Q16 x86_64 20170114 http://www.imagemagick.org
This version is 'not authorized' to write pdf files
$ convert *.png out-ubuntu.pdf
convert-im6.q16: not authorized `out-ubuntu.pdf' @ error/constitute.c/WriteImage/1037.
$ apt-cache policy imagemagick
imagemagick:
Installed: 8:6.9.7.4+dfsg-16ubuntu6.4
Candidate: 8:6.9.7.4+dfsg-16ubuntu6.4
Version table:
*** 8:6.9.7.4+dfsg-16ubuntu6.4 500
500 http://se.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
500 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages
100 /var/lib/dpkg/status
8:6.9.7.4+dfsg-16ubuntu6 500
500 http://se.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
Via an Ubuntu mailing list I had the following answer (that converting to pdf was turned off because of problems with ImageMagick vulnerabilities)
Is this a bug in ImageMagick convert, specifically for Ubuntu 18.04 LTS,
or is converting to pdf turned off by intention?
The change was intentional. See https://usn.ubuntu.com/3785-1/
Thanks, Jeremy Bicha
add a comment |
A simple command line with ImageMagick convert works for me.
I tested with the following command line (in a directory with 14 png files), and there will be one picture per page in the pdf file.
convert *.png out-parrot.pdf
But there can be problems with some versions of convert
It works as intended with the version of convert in Parrot 4.4
$convert --version
Version: ImageMagick 6.9.10-23 Q16 x86_64 20190101 https://imagemagick.org
but it does not work with the version of convert in Ubuntu 18.04.1 LTS (up to date in February 2019)
$ convert --version
Version: ImageMagick 6.9.7-4 Q16 x86_64 20170114 http://www.imagemagick.org
This version is 'not authorized' to write pdf files
$ convert *.png out-ubuntu.pdf
convert-im6.q16: not authorized `out-ubuntu.pdf' @ error/constitute.c/WriteImage/1037.
$ apt-cache policy imagemagick
imagemagick:
Installed: 8:6.9.7.4+dfsg-16ubuntu6.4
Candidate: 8:6.9.7.4+dfsg-16ubuntu6.4
Version table:
*** 8:6.9.7.4+dfsg-16ubuntu6.4 500
500 http://se.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
500 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages
100 /var/lib/dpkg/status
8:6.9.7.4+dfsg-16ubuntu6 500
500 http://se.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
Via an Ubuntu mailing list I had the following answer (that converting to pdf was turned off because of problems with ImageMagick vulnerabilities)
Is this a bug in ImageMagick convert, specifically for Ubuntu 18.04 LTS,
or is converting to pdf turned off by intention?
The change was intentional. See https://usn.ubuntu.com/3785-1/
Thanks, Jeremy Bicha
add a comment |
A simple command line with ImageMagick convert works for me.
I tested with the following command line (in a directory with 14 png files), and there will be one picture per page in the pdf file.
convert *.png out-parrot.pdf
But there can be problems with some versions of convert
It works as intended with the version of convert in Parrot 4.4
$convert --version
Version: ImageMagick 6.9.10-23 Q16 x86_64 20190101 https://imagemagick.org
but it does not work with the version of convert in Ubuntu 18.04.1 LTS (up to date in February 2019)
$ convert --version
Version: ImageMagick 6.9.7-4 Q16 x86_64 20170114 http://www.imagemagick.org
This version is 'not authorized' to write pdf files
$ convert *.png out-ubuntu.pdf
convert-im6.q16: not authorized `out-ubuntu.pdf' @ error/constitute.c/WriteImage/1037.
$ apt-cache policy imagemagick
imagemagick:
Installed: 8:6.9.7.4+dfsg-16ubuntu6.4
Candidate: 8:6.9.7.4+dfsg-16ubuntu6.4
Version table:
*** 8:6.9.7.4+dfsg-16ubuntu6.4 500
500 http://se.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
500 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages
100 /var/lib/dpkg/status
8:6.9.7.4+dfsg-16ubuntu6 500
500 http://se.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
Via an Ubuntu mailing list I had the following answer (that converting to pdf was turned off because of problems with ImageMagick vulnerabilities)
Is this a bug in ImageMagick convert, specifically for Ubuntu 18.04 LTS,
or is converting to pdf turned off by intention?
The change was intentional. See https://usn.ubuntu.com/3785-1/
Thanks, Jeremy Bicha
A simple command line with ImageMagick convert works for me.
I tested with the following command line (in a directory with 14 png files), and there will be one picture per page in the pdf file.
convert *.png out-parrot.pdf
But there can be problems with some versions of convert
It works as intended with the version of convert in Parrot 4.4
$convert --version
Version: ImageMagick 6.9.10-23 Q16 x86_64 20190101 https://imagemagick.org
but it does not work with the version of convert in Ubuntu 18.04.1 LTS (up to date in February 2019)
$ convert --version
Version: ImageMagick 6.9.7-4 Q16 x86_64 20170114 http://www.imagemagick.org
This version is 'not authorized' to write pdf files
$ convert *.png out-ubuntu.pdf
convert-im6.q16: not authorized `out-ubuntu.pdf' @ error/constitute.c/WriteImage/1037.
$ apt-cache policy imagemagick
imagemagick:
Installed: 8:6.9.7.4+dfsg-16ubuntu6.4
Candidate: 8:6.9.7.4+dfsg-16ubuntu6.4
Version table:
*** 8:6.9.7.4+dfsg-16ubuntu6.4 500
500 http://se.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
500 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages
100 /var/lib/dpkg/status
8:6.9.7.4+dfsg-16ubuntu6 500
500 http://se.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
Via an Ubuntu mailing list I had the following answer (that converting to pdf was turned off because of problems with ImageMagick vulnerabilities)
Is this a bug in ImageMagick convert, specifically for Ubuntu 18.04 LTS,
or is converting to pdf turned off by intention?
The change was intentional. See https://usn.ubuntu.com/3785-1/
Thanks, Jeremy Bicha
edited Feb 12 at 19:48
answered Feb 11 at 12:07
sudodussudodus
1,54837
1,54837
add a comment |
add a comment |
It depends on the filesystem. For example, on my host, I am using the fourth extended filesystem (ext4), and stat reports thusly for files:
$ touch foo; stat foo; rm foo
File: 'foo'
Size: 0 Blocks: 0 IO Block: 4096 regular empty file
Device: fc00h/64512d Inode: 262155 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 1000/ ownerusername) Gid: ( 1000/ ownerusername)
Access: 2017-06-21 14:28:16.150323827 -0700
Modify: 2017-06-21 14:28:16.150323827 -0700
Change: 2017-06-21 14:28:16.150323827 -0700
Birth: -
So you can use the last-modified time as create time is something of a misnomer.
find /path/to/images -type f -print0 -name *.jpg | xargs -0 stat -c "%y|%n" | sort | awk -F'|' '{print $2}'
This somewhat cumbersome construct will give you a list of files in order by last modification time (provided you have no files with | in their names).
Once you have and have reviewed this list, you can use Imagemagick's convert tool to assemble the PDF:
convert <<list of files>> outputfile.pdf
Or, to do it all at once:
convert $(find /path/to/images -type f -print0 -name *.jpg | xargs -0 stat -c "%y|%n" | sort | awk -F'|' '{print $2}') outputfile.pdf
The OP mentions nothing about parsing exif data, however.
– DopeGhoti
Jun 21 '17 at 21:51
DopeGhoti, thank you very much your reply. When I try the above command I get the following error messagestat: illegal option -- c. It is true, the picture I have do not have EXIF data.
– Til Hund
Jun 22 '17 at 20:17
Do you know which filesystem is in question here?stat -cworks for me in my tests.
– DopeGhoti
Jun 22 '17 at 20:31
I might add that I want to use the above command on a Mac. I did not mentioned it before as I thought it would be irrelevant to the question. The filesystem would beHFS PlusorMac OS Extended (Journaled).
– Til Hund
Jun 23 '17 at 8:04
For a Mac, usestat -f "%a|%N".
– DopeGhoti
Jun 28 '17 at 16:05
|
show 1 more comment
It depends on the filesystem. For example, on my host, I am using the fourth extended filesystem (ext4), and stat reports thusly for files:
$ touch foo; stat foo; rm foo
File: 'foo'
Size: 0 Blocks: 0 IO Block: 4096 regular empty file
Device: fc00h/64512d Inode: 262155 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 1000/ ownerusername) Gid: ( 1000/ ownerusername)
Access: 2017-06-21 14:28:16.150323827 -0700
Modify: 2017-06-21 14:28:16.150323827 -0700
Change: 2017-06-21 14:28:16.150323827 -0700
Birth: -
So you can use the last-modified time as create time is something of a misnomer.
find /path/to/images -type f -print0 -name *.jpg | xargs -0 stat -c "%y|%n" | sort | awk -F'|' '{print $2}'
This somewhat cumbersome construct will give you a list of files in order by last modification time (provided you have no files with | in their names).
Once you have and have reviewed this list, you can use Imagemagick's convert tool to assemble the PDF:
convert <<list of files>> outputfile.pdf
Or, to do it all at once:
convert $(find /path/to/images -type f -print0 -name *.jpg | xargs -0 stat -c "%y|%n" | sort | awk -F'|' '{print $2}') outputfile.pdf
The OP mentions nothing about parsing exif data, however.
– DopeGhoti
Jun 21 '17 at 21:51
DopeGhoti, thank you very much your reply. When I try the above command I get the following error messagestat: illegal option -- c. It is true, the picture I have do not have EXIF data.
– Til Hund
Jun 22 '17 at 20:17
Do you know which filesystem is in question here?stat -cworks for me in my tests.
– DopeGhoti
Jun 22 '17 at 20:31
I might add that I want to use the above command on a Mac. I did not mentioned it before as I thought it would be irrelevant to the question. The filesystem would beHFS PlusorMac OS Extended (Journaled).
– Til Hund
Jun 23 '17 at 8:04
For a Mac, usestat -f "%a|%N".
– DopeGhoti
Jun 28 '17 at 16:05
|
show 1 more comment
It depends on the filesystem. For example, on my host, I am using the fourth extended filesystem (ext4), and stat reports thusly for files:
$ touch foo; stat foo; rm foo
File: 'foo'
Size: 0 Blocks: 0 IO Block: 4096 regular empty file
Device: fc00h/64512d Inode: 262155 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 1000/ ownerusername) Gid: ( 1000/ ownerusername)
Access: 2017-06-21 14:28:16.150323827 -0700
Modify: 2017-06-21 14:28:16.150323827 -0700
Change: 2017-06-21 14:28:16.150323827 -0700
Birth: -
So you can use the last-modified time as create time is something of a misnomer.
find /path/to/images -type f -print0 -name *.jpg | xargs -0 stat -c "%y|%n" | sort | awk -F'|' '{print $2}'
This somewhat cumbersome construct will give you a list of files in order by last modification time (provided you have no files with | in their names).
Once you have and have reviewed this list, you can use Imagemagick's convert tool to assemble the PDF:
convert <<list of files>> outputfile.pdf
Or, to do it all at once:
convert $(find /path/to/images -type f -print0 -name *.jpg | xargs -0 stat -c "%y|%n" | sort | awk -F'|' '{print $2}') outputfile.pdf
It depends on the filesystem. For example, on my host, I am using the fourth extended filesystem (ext4), and stat reports thusly for files:
$ touch foo; stat foo; rm foo
File: 'foo'
Size: 0 Blocks: 0 IO Block: 4096 regular empty file
Device: fc00h/64512d Inode: 262155 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 1000/ ownerusername) Gid: ( 1000/ ownerusername)
Access: 2017-06-21 14:28:16.150323827 -0700
Modify: 2017-06-21 14:28:16.150323827 -0700
Change: 2017-06-21 14:28:16.150323827 -0700
Birth: -
So you can use the last-modified time as create time is something of a misnomer.
find /path/to/images -type f -print0 -name *.jpg | xargs -0 stat -c "%y|%n" | sort | awk -F'|' '{print $2}'
This somewhat cumbersome construct will give you a list of files in order by last modification time (provided you have no files with | in their names).
Once you have and have reviewed this list, you can use Imagemagick's convert tool to assemble the PDF:
convert <<list of files>> outputfile.pdf
Or, to do it all at once:
convert $(find /path/to/images -type f -print0 -name *.jpg | xargs -0 stat -c "%y|%n" | sort | awk -F'|' '{print $2}') outputfile.pdf
edited Feb 11 at 9:09
Pang
12315
12315
answered Jun 21 '17 at 21:42
DopeGhotiDopeGhoti
45.8k55988
45.8k55988
The OP mentions nothing about parsing exif data, however.
– DopeGhoti
Jun 21 '17 at 21:51
DopeGhoti, thank you very much your reply. When I try the above command I get the following error messagestat: illegal option -- c. It is true, the picture I have do not have EXIF data.
– Til Hund
Jun 22 '17 at 20:17
Do you know which filesystem is in question here?stat -cworks for me in my tests.
– DopeGhoti
Jun 22 '17 at 20:31
I might add that I want to use the above command on a Mac. I did not mentioned it before as I thought it would be irrelevant to the question. The filesystem would beHFS PlusorMac OS Extended (Journaled).
– Til Hund
Jun 23 '17 at 8:04
For a Mac, usestat -f "%a|%N".
– DopeGhoti
Jun 28 '17 at 16:05
|
show 1 more comment
The OP mentions nothing about parsing exif data, however.
– DopeGhoti
Jun 21 '17 at 21:51
DopeGhoti, thank you very much your reply. When I try the above command I get the following error messagestat: illegal option -- c. It is true, the picture I have do not have EXIF data.
– Til Hund
Jun 22 '17 at 20:17
Do you know which filesystem is in question here?stat -cworks for me in my tests.
– DopeGhoti
Jun 22 '17 at 20:31
I might add that I want to use the above command on a Mac. I did not mentioned it before as I thought it would be irrelevant to the question. The filesystem would beHFS PlusorMac OS Extended (Journaled).
– Til Hund
Jun 23 '17 at 8:04
For a Mac, usestat -f "%a|%N".
– DopeGhoti
Jun 28 '17 at 16:05
The OP mentions nothing about parsing exif data, however.
– DopeGhoti
Jun 21 '17 at 21:51
The OP mentions nothing about parsing exif data, however.
– DopeGhoti
Jun 21 '17 at 21:51
DopeGhoti, thank you very much your reply. When I try the above command I get the following error message
stat: illegal option -- c. It is true, the picture I have do not have EXIF data.– Til Hund
Jun 22 '17 at 20:17
DopeGhoti, thank you very much your reply. When I try the above command I get the following error message
stat: illegal option -- c. It is true, the picture I have do not have EXIF data.– Til Hund
Jun 22 '17 at 20:17
Do you know which filesystem is in question here?
stat -c works for me in my tests.– DopeGhoti
Jun 22 '17 at 20:31
Do you know which filesystem is in question here?
stat -c works for me in my tests.– DopeGhoti
Jun 22 '17 at 20:31
I might add that I want to use the above command on a Mac. I did not mentioned it before as I thought it would be irrelevant to the question. The filesystem would be
HFS Plus or Mac OS Extended (Journaled).– Til Hund
Jun 23 '17 at 8:04
I might add that I want to use the above command on a Mac. I did not mentioned it before as I thought it would be irrelevant to the question. The filesystem would be
HFS Plus or Mac OS Extended (Journaled).– Til Hund
Jun 23 '17 at 8:04
For a Mac, use
stat -f "%a|%N".– DopeGhoti
Jun 28 '17 at 16:05
For a Mac, use
stat -f "%a|%N".– DopeGhoti
Jun 28 '17 at 16:05
|
show 1 more comment
Install ImageMagick. Assuming the JPG images are in ~/images and the file names don't contain any spaces (nor any of [*?) and you have a directory ~/combined:
convert -combine -append $(ls -tr ~/images/*.jpg) ~/combined/all.jpg
or
convert -combine -append $(ls -tr ~/images/*.jpg) ~/combined/all.pdf
If the images are not the same size, you will get warnings. -append combines images top to bottom. Change to +append and images will combine left to right.
Time: Although ls -l shows time down to hour:minute, Linux keeps track of the access, modify, and age/change times down to the nano second I believe. So sorting by ls -tr does account for even fractions of seconds.
1
Don't parsels.
– DopeGhoti
Jun 21 '17 at 21:43
Thank you, Deathgrip, for answering. How can I convert the pictures into a single pdf as asked above?
– Til Hund
Jun 21 '17 at 21:43
@DopeGhoti - huh? the command works fine and I tested it using CentOS 7.
– Deathgrip
Jun 21 '17 at 21:46
It will fail if any of those file names contains[[:space:]]...
– don_crissti
Jun 21 '17 at 21:47
Trying to parse the output of anlsis an exercise which, while it may seem to work, is a terribly bad habit to get into for many many security-related reasons, which the link included in my answer goes into in great detail. More detail can be found here.
– DopeGhoti
Jun 21 '17 at 21:47
|
show 1 more comment
Install ImageMagick. Assuming the JPG images are in ~/images and the file names don't contain any spaces (nor any of [*?) and you have a directory ~/combined:
convert -combine -append $(ls -tr ~/images/*.jpg) ~/combined/all.jpg
or
convert -combine -append $(ls -tr ~/images/*.jpg) ~/combined/all.pdf
If the images are not the same size, you will get warnings. -append combines images top to bottom. Change to +append and images will combine left to right.
Time: Although ls -l shows time down to hour:minute, Linux keeps track of the access, modify, and age/change times down to the nano second I believe. So sorting by ls -tr does account for even fractions of seconds.
1
Don't parsels.
– DopeGhoti
Jun 21 '17 at 21:43
Thank you, Deathgrip, for answering. How can I convert the pictures into a single pdf as asked above?
– Til Hund
Jun 21 '17 at 21:43
@DopeGhoti - huh? the command works fine and I tested it using CentOS 7.
– Deathgrip
Jun 21 '17 at 21:46
It will fail if any of those file names contains[[:space:]]...
– don_crissti
Jun 21 '17 at 21:47
Trying to parse the output of anlsis an exercise which, while it may seem to work, is a terribly bad habit to get into for many many security-related reasons, which the link included in my answer goes into in great detail. More detail can be found here.
– DopeGhoti
Jun 21 '17 at 21:47
|
show 1 more comment
Install ImageMagick. Assuming the JPG images are in ~/images and the file names don't contain any spaces (nor any of [*?) and you have a directory ~/combined:
convert -combine -append $(ls -tr ~/images/*.jpg) ~/combined/all.jpg
or
convert -combine -append $(ls -tr ~/images/*.jpg) ~/combined/all.pdf
If the images are not the same size, you will get warnings. -append combines images top to bottom. Change to +append and images will combine left to right.
Time: Although ls -l shows time down to hour:minute, Linux keeps track of the access, modify, and age/change times down to the nano second I believe. So sorting by ls -tr does account for even fractions of seconds.
Install ImageMagick. Assuming the JPG images are in ~/images and the file names don't contain any spaces (nor any of [*?) and you have a directory ~/combined:
convert -combine -append $(ls -tr ~/images/*.jpg) ~/combined/all.jpg
or
convert -combine -append $(ls -tr ~/images/*.jpg) ~/combined/all.pdf
If the images are not the same size, you will get warnings. -append combines images top to bottom. Change to +append and images will combine left to right.
Time: Although ls -l shows time down to hour:minute, Linux keeps track of the access, modify, and age/change times down to the nano second I believe. So sorting by ls -tr does account for even fractions of seconds.
edited Jun 22 '17 at 23:33
Gilles
539k12810891606
539k12810891606
answered Jun 21 '17 at 21:37
DeathgripDeathgrip
1,424313
1,424313
1
Don't parsels.
– DopeGhoti
Jun 21 '17 at 21:43
Thank you, Deathgrip, for answering. How can I convert the pictures into a single pdf as asked above?
– Til Hund
Jun 21 '17 at 21:43
@DopeGhoti - huh? the command works fine and I tested it using CentOS 7.
– Deathgrip
Jun 21 '17 at 21:46
It will fail if any of those file names contains[[:space:]]...
– don_crissti
Jun 21 '17 at 21:47
Trying to parse the output of anlsis an exercise which, while it may seem to work, is a terribly bad habit to get into for many many security-related reasons, which the link included in my answer goes into in great detail. More detail can be found here.
– DopeGhoti
Jun 21 '17 at 21:47
|
show 1 more comment
1
Don't parsels.
– DopeGhoti
Jun 21 '17 at 21:43
Thank you, Deathgrip, for answering. How can I convert the pictures into a single pdf as asked above?
– Til Hund
Jun 21 '17 at 21:43
@DopeGhoti - huh? the command works fine and I tested it using CentOS 7.
– Deathgrip
Jun 21 '17 at 21:46
It will fail if any of those file names contains[[:space:]]...
– don_crissti
Jun 21 '17 at 21:47
Trying to parse the output of anlsis an exercise which, while it may seem to work, is a terribly bad habit to get into for many many security-related reasons, which the link included in my answer goes into in great detail. More detail can be found here.
– DopeGhoti
Jun 21 '17 at 21:47
1
1
Don't parse
ls.– DopeGhoti
Jun 21 '17 at 21:43
Don't parse
ls.– DopeGhoti
Jun 21 '17 at 21:43
Thank you, Deathgrip, for answering. How can I convert the pictures into a single pdf as asked above?
– Til Hund
Jun 21 '17 at 21:43
Thank you, Deathgrip, for answering. How can I convert the pictures into a single pdf as asked above?
– Til Hund
Jun 21 '17 at 21:43
@DopeGhoti - huh? the command works fine and I tested it using CentOS 7.
– Deathgrip
Jun 21 '17 at 21:46
@DopeGhoti - huh? the command works fine and I tested it using CentOS 7.
– Deathgrip
Jun 21 '17 at 21:46
It will fail if any of those file names contains
[[:space:]]...– don_crissti
Jun 21 '17 at 21:47
It will fail if any of those file names contains
[[:space:]]...– don_crissti
Jun 21 '17 at 21:47
Trying to parse the output of an
ls is an exercise which, while it may seem to work, is a terribly bad habit to get into for many many security-related reasons, which the link included in my answer goes into in great detail. More detail can be found here.– DopeGhoti
Jun 21 '17 at 21:47
Trying to parse the output of an
ls is an exercise which, while it may seem to work, is a terribly bad habit to get into for many many security-related reasons, which the link included in my answer goes into in great detail. More detail can be found here.– DopeGhoti
Jun 21 '17 at 21:47
|
show 1 more comment
Thanks for contributing an answer to Unix & Linux 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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f372578%2fsort-jpg-according-to-creation-date-and-convert-to-single-pdf%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
You can do this easily with
zsh(e.g. custom sorting). I don't have access to OSX so cannot post an answer but this should be piece of cake...– don_crissti
Aug 5 '17 at 9:43