.png to .gif with convert tool.

Discussion in 'Linux' started by Abarbarian, May 18, 2017.

  1. Abarbarian

    Abarbarian Acruncher

    Joined:
    Sep 30, 2005
    Likes Received:
    583
    Location:
    A cabin in the woods by a river
    Had a trip to National Botanic Garden of Wales which has a butterfly house where I took some pictures. On arriving home i found I had what looked like a series of nine pictures that may I thought make a decent .gif.

    [​IMG]

    How would I do this in penguin land ?
    With the "convert" tool I hear you cry. How did I use this tool ?

    Placed all nine pictures in a new folder.

    Opened a terminal in the folder or you could cd to the folder.

    Used these two commands

    Code:
    $ convert -resize 1920x1200 -delay 100 -loop 0 *.jpg myimage.gif
    
    $ convert -resize 640x400 -delay 50 -loop 0 *.jpg myimage.gif
    
    Which gave these results, (click for real size)

    http://i.imgur.com/CAKu2uS.gifv

    http://i.imgur.com/DR0KHQv.gifv


    I decided to use " -resize " as the originals were 4928x3264 which I could have used but it would have made a pretty big .gif.

    Also there are a number of guides showing how to do this same thing out there on the net with " -delay 10 " which will give you a picture change every 0.1 second. That for me was a tad quick so I used " -delay 100 " to give me a one second change, " -delay 50 " for a half second change.
    The " - loop 0 " makes the .gif loop continuously, pretty obvious. You can leave out the command to just run the sequence once. Or you can do " -loop 10 " which will repeat the sequence ten times, adjust the number to suit.

    Running the above on my old 32 bit Dell I thought would take a long time but the command zipped through in less than a minute to give me the .gif. Pretty neat time for an old throwaway pc.

    Help me out here folks,

    Which of the .gif's look best from a picture speed changing viewpoint ? The half second or the one second speed.

    Ta in advance folks [​IMG]
     
    Last edited: May 18, 2017
    Abarbarian, May 18, 2017
    #1
    EvanDavis, Becky and Ian like this.
    1. Advertisements

  2. Abarbarian

    Ian Administrator

    Joined:
    Feb 23, 2002
    Likes Received:
    642
    A nice and simple command line tool - I like it!

    I prefer the slower speed, but smaller size image :).

    I notice that you converted the images to a .GIF, which isn't ideal at handling high quality images (in terms of compression and colours). However, when you've uploaded it to imgur, it's converted to a .GIFV automatically - which is essentially a video file container.

    You may get better results by converting the JPG images to a .MP4, and then let imgur convert it to GIFV - it'll mean you get the better image quality and a smaller file size :). I've got no idea how to do that in Linux though :lol:.
     
    Ian, May 18, 2017
    #2
    1. Advertisements

  3. Abarbarian

    Becky Webmistress Administrator

    Joined:
    Mar 25, 2003
    Likes Received:
    974
    Location:
    Manchester
    I preferred the half second one :thumb:
     
    Becky, May 18, 2017
    #3
  4. Abarbarian

    Abarbarian Acruncher

    Joined:
    Sep 30, 2005
    Likes Received:
    583
    Location:
    A cabin in the woods by a river
    To make a .mp4 from .jpg you can do this,

    Code:
    @mx16reserve:~/ZZZ/Picture conversions
    $ ffmpeg -framerate 1 -i tp-%02d.jpg -c:v libx264 -profile:v high -crf 20 -pix_fmt yuv420p output.mp4
    ffmpeg version 2.8.6-1mx150+1 Copyright (c) 2000-2016 the FFmpeg developers
      built with gcc 4.9.2 (Debian 4.9.2-10)
      configuration: --prefix=/usr --extra-version=1mx150+1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/i386-linux-gnu --incdir=/usr/include/i386-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv --disable-i686
      libavutil      54. 31.100 / 54. 31.100
      libavcodec     56. 60.100 / 56. 60.100
      libavformat    56. 40.101 / 56. 40.101
      libavdevice    56.  4.100 / 56.  4.100
      libavfilter     5. 40.101 /  5. 40.101
      libavresample   2.  1.  0 /  2.  1.  0
      libswscale      3.  1.101 /  3.  1.101
      libswresample   1.  2.101 /  1.  2.101
      libpostproc    53.  3.100 / 53.  3.100
    [mjpeg @ 0x9951840] Changeing bps to 8
    Input #0, image2, from 'tp-%02d.jpg':
      Duration: 00:00:09.00, start: 0.000000, bitrate: N/A
        Stream #0:0: Video: mjpeg, yuvj422p(pc, bt470bg/unknown/unknown), 1812x1200 [SAR 300:300 DAR 151:100], 1 fps, 1 tbr, 1 tbn, 1 tbc
    [swscaler @ 0x9960e20] deprecated pixel format used, make sure you did set range correctly
    [libx264 @ 0x9953ca0] using SAR=1/1
    [libx264 @ 0x9953ca0] using cpu capabilities: MMX2 SSE2 SSE3 Cache64
    [libx264 @ 0x9953ca0] profile High, level 4.2
    [libx264 @ 0x9953ca0] 264 - core 142 r2431 a5831aa - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=3 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=1 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=20.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    Output #0, mp4, to 'output.mp4':
      Metadata:
        encoder         : Lavf56.40.101
        Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1812x1200 [SAR 1:1 DAR 151:100], q=-1--1, 1 fps, 16384 tbn, 1 tbc
        Metadata:
          encoder         : Lavc56.60.100 libx264
    Stream mapping:
      Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
    Press [q] to stop, [?] for help
    frame=    9 fps=0.9 q=-1.0 Lsize=    2896kB time=00:00:07.00 bitrate=3389.2kbits/s   
    video:2895kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.031100%
    [libx264 @ 0x9953ca0] frame I:3     Avg QP: 9.70  size:472415
    [libx264 @ 0x9953ca0] frame P:5     Avg QP:12.25  size:257826
    [libx264 @ 0x9953ca0] frame B:1     Avg QP:12.98  size:257534
    [libx264 @ 0x9953ca0] consecutive B-frames: 77.8% 22.2%  0.0%  0.0%
    [libx264 @ 0x9953ca0] mb I  I16..4:  7.6% 66.9% 25.5%
    [libx264 @ 0x9953ca0] mb P  I16..4:  4.5% 41.1%  7.9%  P16..4: 14.1% 19.8% 11.7%  0.0%  0.0%    skip: 1.0%
    [libx264 @ 0x9953ca0] mb B  I16..4:  1.3% 32.8%  1.9%  B16..8: 20.9% 20.6%  8.5%  direct:13.6%  skip: 0.4%  L0:20.6% L1:61.0% BI:18.3%
    [libx264 @ 0x9953ca0] 8x8 transform intra:72.8% inter:52.7%
    [libx264 @ 0x9953ca0] coded y,uvDC,uvAC intra: 97.0% 93.7% 91.1% inter: 82.1% 67.1% 29.3%
    [libx264 @ 0x9953ca0] i16 v,h,dc,p:  5%  3%  8% 84%
    [libx264 @ 0x9953ca0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 17% 14% 16%  7% 10% 10%  9% 10%  9%
    [libx264 @ 0x9953ca0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 14% 13% 12%  8% 14% 13% 10%  9%  7%
    [libx264 @ 0x9953ca0] i8c dc,h,v,p: 47% 22% 17% 13%
    [libx264 @ 0x9953ca0] Weighted P-Frames: Y:20.0% UV:0.0%
    [libx264 @ 0x9953ca0] ref P L0: 95.9%  1.1%  1.7%  1.3%
    [libx264 @ 0x9953ca0] kb/s:2634.58
    
    The blue highlight is the code. This made a working video playable in mpv but for some reason, probably a missing codec, not in vlc.
    Imgur makes .gif's from videos from url's not it seems from uploads from a home pc. An I can not see how to upload a .mp4 to here. I'll find my dropbox password tomorrow and give a link to the .mp4 I created.

    :cool:
     
    Abarbarian, May 18, 2017
    #4
    Ian likes this.
  5. Abarbarian

    Abarbarian Acruncher

    Joined:
    Sep 30, 2005
    Likes Received:
    583
    Location:
    A cabin in the woods by a river
    It seems that the sites buggy software has struck again.

    I highlighted the code whilst composing the post and everything looked as it should. However on completing posting the entry the blue highlighting has disappeared. :(
    I am not a fan of the way quotes and code are done with the new layout, the old way was much more poster friendly. :rolleyes:
     
    Abarbarian, May 19, 2017
    #5
  6. Abarbarian

    Ian Administrator

    Joined:
    Feb 23, 2002
    Likes Received:
    642
    The "code" tags take out all formatting - however, if you use the "quote" option instead, it should retain all formatting :thumb:. In this case, it's worked as the developers intended, even if it's not how it may be expected.
     
    Ian, May 19, 2017
    #6
    Abarbarian likes this.
  7. Abarbarian

    V_R ¯\_(ツ)_/¯ Moderator

    Joined:
    Jan 31, 2005
    Likes Received:
    1,040
    Location:
    127.0.0.1
    V_R, May 19, 2017
    #7
  8. Abarbarian

    Abarbarian Acruncher

    Joined:
    Sep 30, 2005
    Likes Received:
    583
    Location:
    A cabin in the woods by a river
    Neat to know but a tad long winded for me. All that signing in etc etc and waiting for the site to load etc etc. I'll check it out if I ever find the time. :cool:
     
    Abarbarian, May 19, 2017
    #8
  9. Abarbarian

    Abarbarian Acruncher

    Joined:
    Sep 30, 2005
    Likes Received:
    583
    Location:
    A cabin in the woods by a river
    http://i.imgur.com/ODAlj32.gifv

    Could not find a way to show a IMGUR.gifv so there is a link above for some more flutterbyes from the welsh national gardens. This time with a one and a half second delay.
    The pupae cabinets are cool as are the strange caterpillars.

    This is the code

    Code:
    $ convert -resize 1920x1200 -delay 150 -loop 0 *.JPG butterfly3.gif
    On this old Dell

    Code:
    $ inxi -C
    CPU:       Single core Intel Pentium 4 (-HT-) cache: 1024 KB
               clock speeds: max: 2992 MHz 1: 2992 MHz 2: 2992 MHz
    
    it took about three minutes to convert 25 photographs to a .gif. On a modern pc it would be much faster. The time taken is not half bad as I was surfing the net whilst the conversion was running.
     
    Last edited: May 19, 2017
    Abarbarian, May 19, 2017
    #9
  10. Abarbarian

    Abarbarian Acruncher

    Joined:
    Sep 30, 2005
    Likes Received:
    583
    Location:
    A cabin in the woods by a river
    Ok thanks for the explanation. A pox on developers who think it is cool to take a way that working and "improve" it. All that these so called improvements do is put use users in a constant looping learning cycle and nine times out of ten they do not really improve anything.

    rant rant rant :rolleyes:
     
    Abarbarian, May 19, 2017
    #10
  11. Abarbarian

    V_R ¯\_(ツ)_/¯ Moderator

    Joined:
    Jan 31, 2005
    Likes Received:
    1,040
    Location:
    127.0.0.1

    Nah its not long winded, it does it for you. :)
     
    V_R, May 19, 2017
    #11
  12. Abarbarian

    Abarbarian Acruncher

    Joined:
    Sep 30, 2005
    Likes Received:
    583
    Location:
    A cabin in the woods by a river
    I managed to make a .mp4 file
    Here is a dropbox link for the .mp4. To be honest it looks pretty much the same quality as the .gif's. :cool:
     
    Abarbarian, May 20, 2017
    #12
  13. Abarbarian

    Urmas Subarctic Penguin

    Joined:
    Mar 11, 2008
    Likes Received:
    705
    Location:
    Finland
  14. Abarbarian

    Abarbarian Acruncher

    Joined:
    Sep 30, 2005
    Likes Received:
    583
    Location:
    A cabin in the woods by a river
    Ta.

    I have used the Image Magik manual a few times over the years. Always going away with a headache as there is so so much information given for even the simplest task. If I had a couple of life times to spare I would love to become an accomplished user of the program. :lol:
     
    Abarbarian, May 20, 2017
    #14
    1. Advertisements

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
  1. Quadophile
    Replies:
    3
    Views:
    6,465
    Abarbarian
    May 18, 2012
  2. Abarbarian

    Scrot - screenshot tool

    Abarbarian, Mar 4, 2012, in forum: Linux
    Replies:
    3
    Views:
    3,092
    Abarbarian
    Mar 10, 2012
  3. Abarbarian

    Easy2Boot a very neat tool.

    Abarbarian, Mar 28, 2014, in forum: Linux
    Replies:
    6
    Views:
    5,936
    steve6375
    Mar 29, 2014
Loading...