Page 1 of 1

Using the newest image in a list command

Posted: 2018-06-24T16:50:06-07:00
by Observatory Gromme
Dear,

I want to composite 2 images and save them with the name of the first image and the letter F
But: one of the 2 images, must be the newest image in the folder list ( according to image build date in the folder ), and this image name , must also be the final saving image with "F" behind the image name.

So i have this command in the particular folder: composite -gravity north "20180614_120000_SQM-LE SN-3515-N-XXX-Observatory Gromme.png" SQM.png "20180614_120000_SQM-LE SN-3515-N-XXX-Observatory Gromme_F.png"

The file: "20180614_120000_SQM-LE SN-3515-N-XXX-Observatory Gromme.png" is the newest file in the list, so it must be put on "SQM.png"

But how can i now let it automatically take the newest image in the list and run the single command. ( Because every day the newest image changes by name) and then save it as the name of the newest file with _F behind.

For example this is how the list looks like:

-rw-r--r-- 1 root root 139073 Jun 12 04:43 20180611_120000_SQM-LE SN-3515-N-XXX-Observatory Gromme.png
-rw-r--r-- 1 root root 142006 Jun 13 04:43 20180612_120000_SQM-LE SN-3515-N-XXX-Observatory Gromme.png
-rw-r--r-- 1 root root 141784 Jun 14 04:41 20180613_120000_SQM-LE SN-3515-N-XXX-Observatory Gromme.png
-rw-r--r-- 1 root root 142647 Jun 15 04:42 20180614_120000_SQM-LE SN-3515-N-XXX-Observatory Gromme.png
-rw-r--r-- 1 root root 142393 Jun 16 04:42 20180615_120000_SQM-LE SN-3515-N-XXX-Observatory Gromme.png
-rw-r--r-- 1 root root 139940 Jun 17 04:39 20180616_120000_SQM-LE SN-3515-N-XXX-Observatory Gromme.png
-rw-r--r-- 1 root root 142709 Jun 18 04:43 20180617_120000_SQM-LE SN-3515-N-XXX-Observatory Gromme.png
-rw-r--r-- 1 root root 137765 Jun 19 04:43 20180618_120000_SQM-LE SN-3515-N-XXX-Observatory Gromme.png
-rw-r--r-- 1 root root 141946 Jun 20 04:43 20180619_120000_SQM-LE SN-3515-N-XXX-Observatory Gromme.png
-rw-r--r-- 1 root root 139317 Jun 21 04:43 20180620_120000_SQM-LE SN-3515-N-XXX-Observatory Gromme.png
-rw-r--r-- 1 root root 138174 Jun 22 04:43 20180621_120000_SQM-LE SN-3515-N-XXX-Observatory Gromme.png
-rw-r--r-- 1 root root 139175 Jun 23 04:42 20180622_120000_SQM-LE SN-3515-N-XXX-Observatory Gromme.png
-rw-r--r-- 1 root root 141648 Jun 24 04:41 20180623_120000_SQM-LE SN-3515-N-XXX-Observatory Gromme.png
-rw-r--r-- 1 root root 121577 Jun 24 22:17 20180624_120000_SQM-LE SN-3515-N-XXX-Observatory Gromme.png


Later on i will use Cron do run this single command, one time, every day around 10h UT, so it takes always the newest file

Thank you.

Re: Using the newest image in a list command

Posted: 2018-06-24T17:17:42-07:00
by fmw42
Please, always provide your IM version and platform when asking questions, since syntax may differ. Also provide your exact command line and if possible your images.

See the top-most post in this forum "IMPORTANT: Please Read This FIRST Before Posting" at http://www.imagemagick.org/discourse-se ... f=1&t=9620

For novices, see

http://www.imagemagick.org/discourse-se ... f=1&t=9620
http://www.imagemagick.org/script/comma ... essing.php
http://www.imagemagick.org/Usage/reference.html
http://www.imagemagick.org/Usage/
https://github.com/ImageMagick/usage-markdown