Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

[solved] image display speed

edited October 2013 in OpenSesame

I am building my third exp/ in opensesame and the program is great
in my new exp i want to display an image that looks like it is coming to or from the viewer
I used the scale image option but the problem is that the image animation is not smooth but "jumps"
I attached the image display code
would appreciate you help


  • edited 11:23PM

    Hi Dror,

    I see. In principle your approach is fine: Simply draw a series of frames that scale the image differently. But your implementation may be too slow, which is why it jumps. The easiest way to make the process faster is to construct all canvas objects first, and then show them one after another. That way the animation won't be slowed down by the canvas preparation time. For example:

    import numpy as np
    from openexp.canvas import canvas
    # Create an array (numpy list) of scaling factors
    # from 0.5 to 1 in 20 steps.
    scale_array = np.linspace(0.5, 1, 20)
    # The full path to the image in the file pool
    my_image = exp.get_file('image.png')
    # Create a list of canvas objects with differently
    # scaled images.
    canvas_list = []
    for scale in scale_array:
        my_canvas = canvas(exp)
        my_canvas.image(my_image, scale=scale)
    # Show the canvas objects one after another!
    for my_canvas in canvas_list:

    Alternatively, you can directly use the PsychoPy or Expyriment functions, which allow you to scale images as well. This will probably be even more efficient, but I doubt that it will be necessary in this case:


    Buy Me A Coffee

  • edited 11:23PM

    I used the array and it works better(the animation itself)
    every trail is a different stim and it takes 5-8 seconds before every trail starts
    is there a way to speed things up
    I have a fixation of 1 second before every animation and scaling procedure after every stim in every trail

  • edited 11:23PM

    As I mentioned, an alternative would be to use PsychoPy directly. PsychoPy allows you to change the size of the object on the fly, without requiring you to prepare each frame separately. The downside is (or could be) that you are tied to the psycho back-end when you use this approach:

    from psychopy.visual import ImageStim
    import numpy as np
    from scipy.misc import imread
    # Create an array (numpy list) of scaling factors
    # from 0.5 to 1 in 10 steps.
    scale_array = np.linspace(0.5, 1, 100)
    # The full path to the image in the file pool
    my_image = exp.get_file('image.png')
    # Get the size of the image by reading into a numpy array
    # and getting the shape of the array
    height, width = imread(my_image, flatten=True).shape
    # Create an ImageStim object
    img = ImageStim(win, image=my_image)
    # Repeatedly show the image and change the size on each
    # showing
    for scale in scale_array:
        img.setSize( (width*scale, height*scale) )

    Buy Me A Coffee

  • edited 11:23PM

    works like a charm/
    thank you/

Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games