Git Product home page Git Product logo

[Feature Request]: Fill screen with stimuli such as video. in their max size without altering aspect ratio I.E. Don't stretch it, , just fill the screen, and maintain aspect ratio: Example code inside about psychopy HOT 3 OPEN

MichaelWoodc avatar MichaelWoodc commented on June 12, 2024
[Feature Request]: Fill screen with stimuli such as video. in their max size without altering aspect ratio I.E. Don't stretch it, , just fill the screen, and maintain aspect ratio: Example code inside

from psychopy.

Comments (3)

peircej avatar peircej commented on June 12, 2024

There are 2 parts to this:

  • The first is how to get the full height of the screen which is best achieved using either height or norm units rather than pixels (then you don't need to query the screen etc). Either use height units and set the hegiht to be 1 (because you want 1 screen height high) or use norm units and set the height to be 2 (because the screen ranges -1:1 so it's full height is 2 units long)
  • The second issue is how to scale the width by the same amount as the height. We added the option (certainly to images but I think to movies as well) that you can set a dimension to be None and it will then happily rescale to fit the other dimension

When you put those 2 things together you should be able to do this relatively easily:

  • units = 'height'
  • size = [None, 1]
    to get a full-height, original ratio movie with no code required

from psychopy.

peircej avatar peircej commented on June 12, 2024

Update: I checked and it looked like this was only implemented for images. We'll look to add that probably for the summer 2024 release

And it doesn't have the flexibility to check first which dimension is the larger - you need to decide that yourself in advance. I'm not sure what the best way would be to allow the full version of what you're requesting in the current user interface. As in, where would we put the selection option(s) for "full-screen rescale" or "full-screen stretch"?

from psychopy.

MichaelWoodc avatar MichaelWoodc commented on June 12, 2024

Update: I checked and it looked like this was only implemented for images. We'll look to add that probably for the summer 2024 release

And it doesn't have the flexibility to check first which dimension is the larger - you need to decide that yourself in advance. I'm not sure what the best way would be to allow the full version of what you're requesting in the current user interface. As in, where would we put the selection option(s) for "full-screen rescale" or "full-screen stretch"?

My apologies on the poor code example! The github code feature doesn't agree with my code, as I'm using ' instead of " in my code!

I noticed what you mentioned aswell that it does not have the flexibility to check the size first. When going to get the size of the stim, you must also get the stim clip size only after it's already loaded.

Personally I would either have another drop select before the size to determine if it is "Shrink to fit", "stretch to fit", or "shrink or stretch to fit" if either is selected then there's an option to maintain original aspect ratio.

I figure it should go almost first because if you maximize the video size, you're basically guaranteeing that it's going to be centered, and the spatial units don't matter. Neither would the anchor.

To make it a less confusing experience, I would have the dialog box dynamically remove the extreneous options when one of these features is enabled.

I've only taken a brief look under the psychopy hood and I'm not yet sure if it can easily be made dynamic, this option window. I've had success using TKinter to make these kinds of windows with options that dynamically change, but I believe that this window uses WXPython, and I'll have to become familiar with this in the future before I can really know for sure.

Basically have a box at the top like this:
image

If you select shrink or stretch to fit, everything unneeded disappears and you get a checkbox:

image

I hope this makes sense! Probably poor examples! But just the idea that it can come first. A checkbox can be used to activate this mode first. If this checkbox isn't selected, the rest of the menu stays the exact same.

from psychopy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.