I want to convert png to gif and i want to mention which are the frames i want to combine
eg: frame1.png and frame2.png.
I've tried using ffmpeg -i frames/%03d.png -vf fps=20 logo.gif but it is considering all the images in that directory, but i want only two images in that directory to be included in the gif i want to create. Thank you in advance.
Just use the ones you want:
magick -delay 80 nice1.png nice37.png animated.gif
By way of explanation and further example, I can make a red and a blue frame and morph between the two in 14 steps like this - making a total of 16 frames:
magick -size 20x100 xc:red xc:blue -morph 14 frame-%02d.png
If I append those frames side-by-side, you can see them all:
magick frame* +append side-by-side.png
And I can list them in the shell:
-rw-r--r-- 1 mark staff 278 28 Apr 13:45 frame-00.png
-rw-r--r-- 1 mark staff 278 28 Apr 13:45 frame-01.png
-rw-r--r-- 1 mark staff 278 28 Apr 13:45 frame-02.png
-rw-r--r-- 1 mark staff 278 28 Apr 13:45 frame-03.png
-rw-r--r-- 1 mark staff 278 28 Apr 13:45 frame-04.png
-rw-r--r-- 1 mark staff 278 28 Apr 13:45 frame-05.png
-rw-r--r-- 1 mark staff 278 28 Apr 13:45 frame-06.png
-rw-r--r-- 1 mark staff 278 28 Apr 13:45 frame-07.png
-rw-r--r-- 1 mark staff 278 28 Apr 13:45 frame-08.png
-rw-r--r-- 1 mark staff 278 28 Apr 13:45 frame-09.png
-rw-r--r-- 1 mark staff 278 28 Apr 13:45 frame-10.png
-rw-r--r-- 1 mark staff 278 28 Apr 13:45 frame-11.png
-rw-r--r-- 1 mark staff 278 28 Apr 13:45 frame-12.png
-rw-r--r-- 1 mark staff 278 28 Apr 13:45 frame-13.png
-rw-r--r-- 1 mark staff 278 28 Apr 13:45 frame-14.png
-rw-r--r-- 1 mark staff 278 28 Apr 13:45 frame-15.png
If I now want to select some to make an animated GIF, I can use the shell's "brace expansion" to select certain ones:
ls frame-0{2,3,9}.png
frame-02.png frame-03.png frame-09.png
Or the shell's "range expansion" to select a contiguous range:
ls frame-1[2-4].png
frame-12.png frame-13.png frame-14.png
Or the shell's "wildcard expansion":
ls frame-1?.png
frame-10.png frame-11.png frame-12.png frame-13.png frame-14.png frame-15.png
And that works with magick just the same as ls, so I can select a few frames for an animated GIF like this:
magick -delay 80 frame-0{2,4}.png frame-1*.png animated.gif
Related
I have a list of flags located at :
/home/bheng/app/public/assets/be/img/flags/
...
-rw-r--r-- 1 robot robot 4655 Apr 29 16:34 tf_64.png
-rw-r--r-- 1 robot robot 3024 Apr 29 16:34 td_64.png
-rw-r--r-- 1 robot robot 5379 Apr 29 16:34 tc_64.png
-rw-r--r-- 1 robot robot 5316 Apr 29 16:34 sz_64.png
-rw-r--r-- 1 robot robot 3486 Apr 29 16:34 sy_64.png
-rw-r--r-- 1 robot robot 4902 Apr 29 16:34 sx_64.png
-rw-r--r-- 1 robot robot 3508 Apr 29 16:34 sv_64.png
-rw-r--r-- 1 robot robot 3986 Apr 29 16:34 st_64.png
-rw-r--r-- 1 robot robot 4290 Apr 29 16:34 ss_64.png
-rw-r--r-- 1 robot robot 3765 Apr 29 16:34 sr_64.png
-rw-r--r-- 1 robot robot 3856 Apr 29 16:34 so_64.png
-rw-r--r-- 1 robot robot 3580 Apr 29 16:34 sn_64.png
-rw-r--r-- 1 robot robot 4959 Apr 29 16:34 sm_64.png
-rw-r--r-- 1 robot robot 3077 Apr 29 16:34 sl_64.png
-rw-r--r-- 1 robot robot 4483 Apr 29 16:34 sk_64.png
-rw-r--r-- 1 robot robot 3517 Apr 29 16:34 sj_64.png
-rw-r--r-- 1 robot robot 3483 Apr 29 16:34 si_64.png
drwxr-xr-x 2 robot robot 12288 Apr 29 16:34 .
┌──[robot#world]──[/home/bheng/app/public/assets/be/img/flags]
└──
I want to load that image when I visit
https://www.bunlongheng.com/flags/*
Ex.
https://www.bunlongheng.com/flags/sn_64.png
I've tried add this line to my nginx
location ^~ /flags/ {
root /home/bheng/app/public/assets/be/img/flags/;
}
I still get 404 on my URL : https://www.bunlongheng.com/flags/sn_64.png
What did missed?
Also
I've tried alias
location /flags/ {
alias /home/bheng/app/public/assets/be/img/flags/;
#root /home/bheng/app/public/assets/be/img/flags/;
}
You need rewrite instead of alias :
location ~ /assets/be/img/flags/(?<filename>.+)$ {
rewrite ^ /flags/$filename last;
}
or another way maybe you should use root:
location ~ /flags/ {
root /assets/be/img/flags/;
}
but both ways need to use php artisan storage:link, because it's must be a public nginx path.
I have a total of 31 directories. Every directory has a random name.
❯ ls -al
total 32
drwxr-xr-x 34 shinokada staff 1088 Dec 28 17:16 .
drwxr-xr-x 32 shinokada staff 1024 Dec 28 17:12 ..
-rw-r--r--# 1 shinokada staff 14340 Dec 28 17:16 .DS_Store
drwxr-xr-x 5 shinokada staff 160 Dec 28 17:10 05618066
drwxr-xr-x 5 shinokada staff 160 Dec 28 17:08 0fef2d20
drwxr-xr-x 5 shinokada staff 160 Dec 28 17:09 11ff096d
drwxr-xr-x 5 shinokada staff 160 Dec 28 17:09 1651ff1f
drwxr-xr-x 5 shinokada staff 160 Dec 28 17:09 2123b256
... and more
Now I'd like to rename them sample1 sample2 sample3 ...sample31.
How can I do it on a terminal(bash/zsh)?
Is there a quick way to do it rather than rename one by one?
This should do:
num=1; for dir in */ ; do mv "${dir}" "sample$num" ; ((num++)); done
I assume you don't want to rename the files, only directories inside your current working directory.
I am currently sorting the output of ls -l by byte count using:
ls -l | sort -r -k5,5 -n
What if I wanted to make this work with the -# flag? Currently this will output:
-rwxr-xr-x# 1 name staff 7106 2 May 10:43 c
-rwxr-xr-x 1 name staff 675 22 Apr 17:57 a
-rwxr-xr-x 1 name staff 486 23 Apr 07:56 b
drwxr-xr-x 4 name staff 136 25 Apr 18:38 d
-rwxr-xr-x 1 name staff 120 23 Apr 07:59 e
-rwxr-xr-x 1 name staff 112 22 Apr 18:45 g
-rwxr-xr-x 1 name staff 51 22 Apr 18:45 f
total 56
com.apple.metadata:_kMDItemUserTags 42
Where I want it to take the extended attribute keys line and keep it below the appropriate file like so:
-rwxr-xr-x# 1 name staff 7106 2 May 10:43 c
com.apple.metadata:_kMDItemUserTags 42
-rwxr-xr-x 1 name staff 675 22 Apr 17:57 a
-rwxr-xr-x 1 name staff 486 23 Apr 07:56 b
drwxr-xr-x 4 name staff 136 25 Apr 18:38 d
-rwxr-xr-x 1 name staff 120 23 Apr 07:59 e
-rwxr-xr-x 1 name staff 112 22 Apr 18:45 g
-rwxr-xr-x 1 name staff 51 22 Apr 18:45 f
total 56
No need to use sort, just use the -S option with ls
ls -Sl
(that's an upper case S)
Consider the following convenience bash function that is intended not to descend into directories but instead just list them:
12:17:03/shared $type lld
lld is a function
lld ()
{
ls -drlta $1
}
Let us try to use it:
12:17:44/shared $lld pic*
-rw-r--r--# 1 steve staff 249245 Jan 27 16:43 PIClustering.png
That is not correct: but if we add double quotes then it gives correct results:
12:17:20/shared $lld "pic*"
-rw-r--r--# 1 steve staff 249245 Jan 27 16:43 PIClustering.png
-rw-r--r-- 1 steve staff 2004 Jan 27 18:07 pic-15.txt
drwxr-xr-x 42 steve staff 1428 Jan 30 14:30 pic
drwxr-xr-x 43 steve staff 1462 Feb 18 14:33 picsubmean
drwxr-xr-x 41 steve staff 1394 Mar 21 08:32 picschur
The question is: how to modify the lld() function to achieve the latter behavior without requiring quotes?
Replace
ls -drlta $1
by
ls -drlta "$#"
Globs are expanded before functions or commands are called, and each result becomes a separate argument. lld pic* is shorthand for (and indistinguishable from):
lld "PIClustering.png" "pic" "pic-15.txt" "picsubmean" "picschur"
Knowing this, the solution is obvious: instead of listing just the first file specified ($1), you should list all files specified ("$#").
From #etan's comments it is not possible to achieve precisely what I was looking for. The following is a reasonable facsimile:
12:33:10/shared $type lld
lld is a function
lld ()
{
ls -drlta $1*
}
Then use it by:
12:17:44/shared $lld pic
-rw-r-----# 1 steve staff 184655 Jan 26 00:16 picInputOutputs.png
-rw-r--r-- 1 steve staff 794810294 Jan 26 01:11 pic.0126.tgz
drwxr-xr-x 43 steve staff 1462 Jan 27 16:23 picpy
-rw-r--r--# 1 steve staff 249245 Jan 27 16:43 PIClusteringFiveCirclesInputsAndOutputs.png
-rw-r--r-- 1 steve staff 2004 Jan 27 18:07 pic-15.txt
drwxr-xr-x 48 steve staff 1632 Jan 30 12:35 pic.old
Notice: without the glob/asterisk. This function tacks it on automatically. I wanted this helper because it gets used many times daily.
I'm reading this post about go and was trying to compile the source code found here
I downloaded the source code, compiled the first file with make and I can see the object is generated:
$pwd
/Users/oscarryz/code/go/rsc/rosetta/graph
$ls -ltR
total 136
-rw-r--r-- 1 oscarryz staff 61295 Sep 17 16:20 _go_.6
drwxr-xr-x 3 oscarryz staff 102 Sep 17 16:20 _obj
-rw-r--r-- 1 oscarryz staff 126 Sep 17 16:17 Makefile
-rw-r--r-- 1 oscarryz staff 2791 Sep 17 16:17 graph.go
./_obj:
total 0
drwxr-xr-x 3 oscarryz staff 102 Sep 17 16:20 rsc.googlecode.com
./_obj/rsc.googlecode.com:
total 0
drwxr-xr-x 3 oscarryz staff 102 Sep 17 16:20 hg
./_obj/rsc.googlecode.com/hg:
total 0
drwxr-xr-x 3 oscarryz staff 102 Sep 17 16:20 rosetta
./_obj/rsc.googlecode.com/hg/rosetta:
total 136
-rw-r--r-- 1 oscarryz staff 68486 Sep 17 16:20 graph.a
No my question is, how do I refer to that compiled code from the maze directory:
/Users/oscarryz/code/go/rsc/rosetta/maze/maze.go
Whose import declarations are:
import (
"bytes"
"fmt"
"rand"
"time"
"rsc.googlecode.com/hg/rosetta/graph"
)
And right now is failing to compile with the error message:
6g -o _go_.6 maze.go
maze.go:20: can't find import: rsc.googlecode.com/hg/rosetta/graph
make: *** [_go_.6] Error 1
Ok, I found it, wasn't that hard.
6g flags: -I DIR search for packages in DIR
I have to specify the -I option like this:
6g -I ../graph/_obj/ -o _go_.6 maze.go