[visionlist] gif maker?

Jonathan Peirce jon.peirce at gmail.com
Wed Feb 7 06:28:18 -05 2018


This is really easy in Python, with imageio library installed. You can 
write a really simple script, as below.

Using GIMP is fine but not easy to customise or repeat, because of the 
need to go through dialog boxes etc. If you learn to do this efficiently 
in code (Python, Matlab, Mathematica...) then you can do much more 
"reproducible" work.  The script below is the simple version but there 
are many ways to adapt it for, say creating a dialog box to choose the 
input files etc.

If you install a recent version of PsychoPy you'll have a simple editor 
to paste in this script, as well as the imageio lib (i.e. everything you 
need in order to run the code below.

Jon

#-----------------------------

import imageio
import glob

filenames = glob.glob("frames/*.png")  # creates a list of file names 
searching this folder
filenames.sort()  # if you want them in alphabetical order then best to 
do this
outputName = "myAnimation.gif"
secsPerFrame = 1/25.0  # you can provide a list instead, for 1 val per frame
reps = 1  # 1 rep (0 for infinite loop, or some other number for fixed N 
reps)

outputImages = []
for thisFilename in filenames:
     print(thisFilename)
     frame = imageio.imread(thisFilename)
     outputImages.append(frame)

imageio.mimsave(outputName, outputImages, loop=reps, duration=secsPerFrame)
#-----------------------------



On 07/02/2018 01:01, Andrew Watson wrote:
> Mathematica (and I believe Matlab) can stitch together a sequence of 
> frames to make an animated GIF.
>
>
>
>> On Feb 6, 2018, at 10:54 AM, Horowitz, Todd (NIH/NCI) [E] 
>> <todd.horowitz at nih.gov <mailto:todd.horowitz at nih.gov>> wrote:
>>
>> Dear colleagues
>> What software do you use for creating gif files? We want to make gifs 
>> from radiological images, and our collaborators are understandably 
>> not comfortable with uploading the images to online gif-creator 
>> sites. Is there good desktop software for this purpose?
>> thanks
>> Todd
>> _______________________________________________
>> visionlist mailing list
>> visionlist at visionscience.com <mailto:visionlist at visionscience.com>
>> http://visionscience.com/mailman/listinfo/visionlist_visionscience.com
>
>
>
> _______________________________________________
> visionlist mailing list
> visionlist at visionscience.com
> http://visionscience.com/mailman/listinfo/visionlist_visionscience.com




This message and any attachment are intended solely for the addressee
and may contain confidential information. If you have received this
message in error, please contact the sender and delete the email and
attachment. 

Any views or opinions expressed by the author of this email do not
necessarily reflect the views of the University of Nottingham. Email
communications with the University of Nottingham may be monitored 
where permitted by law.




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://visionscience.com/pipermail/visionlist_visionscience.com/attachments/20180207/efab22c0/attachment.html>


More information about the visionlist mailing list