Picture resizing


Author
Message
JuliaJuliaJulia
JuliaJuliaJulia
Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)
Group: Forum Members
Posts: 24, Visits: 82
Dave - Wednesday, February 6, 2019
JuliaJuliaJulia - Wednesday, February 6, 2019
[quote]
Dave - Tuesday, February 5, 2019

If you want the width to be fixed, but the height to vary, that works in the same way.

Ah, so I will create another list element, so that I have in sum two list elements: on for the width and one for the height. 

I just have problems to understand this pice of code:

<picture mypicture>
/ items = myitems
/ height = 80%
/ width = 0%
/ position = (50%, 50%)
</picture>

<list widths>
/ items = (80%, 40%)
/ selectionmode = picture.mypicture.nextindex
</list>

For the first item ("01.jpg"; so the horizontal image) the height is set to 80% and the width also to 80%. But that shouldn't be so: The width should be set to 80% and the hight should be allowed to vary... For the second item ("02.jpg"; so the horizontal image) the height is set to 80% and the width to 40%. That also shouldn't be so: The hight should be set to 80% and the width should be allowed to vary and shouldn't be fixed to 40%...

Is there a possibility to do that?

Best Julia



Just flip what I illustrated for the width in the example I posted around and do it with the height instead. You don't need two lists, you need only one.

<block myblock>
/ trials = [1-2 = mytrial]
</block>

<trial mytrial>
/ ontrialbegin = [picture.mypicture.height = list.heights.nextvalue;]
/ stimulusframes = [1=mypicture]
/ validresponse = (57)
</trial>

<picture mypicture>
/ items = myitems
/ height = 0%
/ width = 40%
/ position = (50%, 50%)
</picture>

<list heights>
/ items = (40%, 80%)
/ selectionmode = picture.mypicture.nextindex
</list>

<item myitems>
/ 1 = "01.jpg"
/ 2 = "02.jpg"
</item>

Run this, and you'll find that the width is now constant, while the height var

JuliaJuliaJulia
JuliaJuliaJulia
Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)
Group: Forum Members
Posts: 24, Visits: 82
JuliaJuliaJulia - Wednesday, February 6, 2019
Dave - Wednesday, February 6, 2019
JuliaJuliaJulia - Wednesday, February 6, 2019
[quote]
Dave - Tuesday, February 5, 2019

If you want the width to be fixed, but the height to vary, that works in the same way.

Ah, so I will create another list element, so that I have in sum two list elements: on for the width and one for the height. 

I just have problems to understand this pice of code:

<picture mypicture>
/ items = myitems
/ height = 80%
/ width = 0%
/ position = (50%, 50%)
</picture>

<list widths>
/ items = (80%, 40%)
/ selectionmode = picture.mypicture.nextindex
</list>

For the first item ("01.jpg"; so the horizontal image) the height is set to 80% and the width also to 80%. But that shouldn't be so: The width should be set to 80% and the hight should be allowed to vary... For the second item ("02.jpg"; so the horizontal image) the height is set to 80% and the width to 40%. That also shouldn't be so: The hight should be set to 80% and the width should be allowed to vary and shouldn't be fixed to 40%...

Is there a possibility to do that?

Best Julia



Just flip what I illustrated for the width in the example I posted around and do it with the height instead. You don't need two lists, you need only one.

<block myblock>
/ trials = [1-2 = mytrial]
</block>

<trial mytrial>
/ ontrialbegin = [picture.mypicture.height = list.heights.nextvalue;]
/ stimulusframes = [1=mypicture]
/ validresponse = (57)
</trial>

<picture mypicture>
/ items = myitems
/ height = 0%
/ width = 40%
/ position = (50%, 50%)
</picture>

<list heights>
/ items = (40%, 80%)
/ selectionmode = picture.mypicture.nextindex
</list>

<item myitems>
/ 1 = "01.jpg"
/ 2 = "02.jpg"
</item>

Run this, and you'll find that the width is now constant, while the height var

Thanks for your code!
I think your code only works because your image 1 is a square, but in my case image 1 looks like "The Annuciation.jpg" and image 2 like "Eight_Famous_Sights_of_Omi.jpg". In your case image 1 is a square, so a hight of 40% and a width of 40% works...
Attachments
The_Annunciation.jpg (399 views, 152.00 KB)
JuliaJuliaJulia
JuliaJuliaJulia
Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)
Group: Forum Members
Posts: 24, Visits: 82
JuliaJuliaJulia - Wednesday, February 6, 2019
JuliaJuliaJulia - Wednesday, February 6, 2019
Dave - Wednesday, February 6, 2019
JuliaJuliaJulia - Wednesday, February 6, 2019
[quote]
Dave - Tuesday, February 5, 2019

If you want the width to be fixed, but the height to vary, that works in the same way.

Ah, so I will create another list element, so that I have in sum two list elements: on for the width and one for the height. 

I just have problems to understand this pice of code:

<picture mypicture>
/ items = myitems
/ height = 80%
/ width = 0%
/ position = (50%, 50%)
</picture>

<list widths>
/ items = (80%, 40%)
/ selectionmode = picture.mypicture.nextindex
</list>

For the first item ("01.jpg"; so the horizontal image) the height is set to 80% and the width also to 80%. But that shouldn't be so: The width should be set to 80% and the hight should be allowed to vary... For the second item ("02.jpg"; so the horizontal image) the height is set to 80% and the width to 40%. That also shouldn't be so: The hight should be set to 80% and the width should be allowed to vary and shouldn't be fixed to 40%...

Is there a possibility to do that?

Best Julia



Just flip what I illustrated for the width in the example I posted around and do it with the height instead. You don't need two lists, you need only one.

<block myblock>
/ trials = [1-2 = mytrial]
</block>

<trial mytrial>
/ ontrialbegin = [picture.mypicture.height = list.heights.nextvalue;]
/ stimulusframes = [1=mypicture]
/ validresponse = (57)
</trial>

<picture mypicture>
/ items = myitems
/ height = 0%
/ width = 40%
/ position = (50%, 50%)
</picture>

<list heights>
/ items = (40%, 80%)
/ selectionmode = picture.mypicture.nextindex
</list>

<item myitems>
/ 1 = "01.jpg"
/ 2 = "02.jpg"
</item>

Run this, and you'll find that the width is now constant, while the height var

Thanks for your code!
I think your code only works because your image 1 is a square, but in my case image 1 looks like "The Annuciation.jpg" and image 2 like "Eight_Famous_Sights_of_Omi.jpg". In your case image 1 is a square, so a hight of 40% and a width of 40% works...

Sorry, the second image cant be loaded, here is the link: https://upload.wikimedia.org/wikipedia/commons/2/2c/Eight_Famous_Sights_of_Omi_by_Imamura_Shiko_%28Tokyo_National_Museum%29.jpg
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 104K
JuliaJuliaJulia - Wednesday, February 6, 2019
JuliaJuliaJulia - Wednesday, February 6, 2019
JuliaJuliaJulia - Wednesday, February 6, 2019
Dave - Wednesday, February 6, 2019
JuliaJuliaJulia - Wednesday, February 6, 2019
[quote]
Dave - Tuesday, February 5, 2019

If you want the width to be fixed, but the height to vary, that works in the same way.

Ah, so I will create another list element, so that I have in sum two list elements: on for the width and one for the height. 

I just have problems to understand this pice of code:

<picture mypicture>
/ items = myitems
/ height = 80%
/ width = 0%
/ position = (50%, 50%)
</picture>

<list widths>
/ items = (80%, 40%)
/ selectionmode = picture.mypicture.nextindex
</list>

For the first item ("01.jpg"; so the horizontal image) the height is set to 80% and the width also to 80%. But that shouldn't be so: The width should be set to 80% and the hight should be allowed to vary... For the second item ("02.jpg"; so the horizontal image) the height is set to 80% and the width to 40%. That also shouldn't be so: The hight should be set to 80% and the width should be allowed to vary and shouldn't be fixed to 40%...

Is there a possibility to do that?

Best Julia



Just flip what I illustrated for the width in the example I posted around and do it with the height instead. You don't need two lists, you need only one.

<block myblock>
/ trials = [1-2 = mytrial]
</block>

<trial mytrial>
/ ontrialbegin = [picture.mypicture.height = list.heights.nextvalue;]
/ stimulusframes = [1=mypicture]
/ validresponse = (57)
</trial>

<picture mypicture>
/ items = myitems
/ height = 0%
/ width = 40%
/ position = (50%, 50%)
</picture>

<list heights>
/ items = (40%, 80%)
/ selectionmode = picture.mypicture.nextindex
</list>

<item myitems>
/ 1 = "01.jpg"
/ 2 = "02.jpg"
</item>

Run this, and you'll find that the width is now constant, while the height var

Thanks for your code!
I think your code only works because your image 1 is a square, but in my case image 1 looks like "The Annuciation.jpg" and image 2 like "Eight_Famous_Sights_of_Omi.jpg". In your case image 1 is a square, so a hight of 40% and a width of 40% works...

Sorry, the second image cant be loaded, here is the link: https://upload.wikimedia.org/wikipedia/commons/2/2c/Eight_Famous_Sights_of_Omi_by_Imamura_Shiko_%28Tokyo_National_Museum%29.jpg

You should adjust the values in the list such that they suit *your* images.

JuliaJuliaJulia
JuliaJuliaJulia
Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)
Group: Forum Members
Posts: 24, Visits: 82
Dave - Wednesday, February 6, 2019
JuliaJuliaJulia - Wednesday, February 6, 2019
JuliaJuliaJulia - Wednesday, February 6, 2019
JuliaJuliaJulia - Wednesday, February 6, 2019
Dave - Wednesday, February 6, 2019
JuliaJuliaJulia - Wednesday, February 6, 2019
[quote]
Dave - Tuesday, February 5, 2019

If you want the width to be fixed, but the height to vary, that works in the same way.

Ah, so I will create another list element, so that I have in sum two list elements: on for the width and one for the height. 

I just have problems to understand this pice of code:

<picture mypicture>
/ items = myitems
/ height = 80%
/ width = 0%
/ position = (50%, 50%)
</picture>

<list widths>
/ items = (80%, 40%)
/ selectionmode = picture.mypicture.nextindex
</list>

For the first item ("01.jpg"; so the horizontal image) the height is set to 80% and the width also to 80%. But that shouldn't be so: The width should be set to 80% and the hight should be allowed to vary... For the second item ("02.jpg"; so the horizontal image) the height is set to 80% and the width to 40%. That also shouldn't be so: The hight should be set to 80% and the width should be allowed to vary and shouldn't be fixed to 40%...

Is there a possibility to do that?

Best Julia



Just flip what I illustrated for the width in the example I posted around and do it with the height instead. You don't need two lists, you need only one.

<block myblock>
/ trials = [1-2 = mytrial]
</block>

<trial mytrial>
/ ontrialbegin = [picture.mypicture.height = list.heights.nextvalue;]
/ stimulusframes = [1=mypicture]
/ validresponse = (57)
</trial>

<picture mypicture>
/ items = myitems
/ height = 0%
/ width = 40%
/ position = (50%, 50%)
</picture>

<list heights>
/ items = (40%, 80%)
/ selectionmode = picture.mypicture.nextindex
</list>

<item myitems>
/ 1 = "01.jpg"
/ 2 = "02.jpg"
</item>

Run this, and you'll find that the width is now constant, while the height var

Thanks for your code!
I think your code only works because your image 1 is a square, but in my case image 1 looks like "The Annuciation.jpg" and image 2 like "Eight_Famous_Sights_of_Omi.jpg". In your case image 1 is a square, so a hight of 40% and a width of 40% works...

Sorry, the second image cant be loaded, here is the link: https://upload.wikimedia.org/wikipedia/commons/2/2c/Eight_Famous_Sights_of_Omi_by_Imamura_Shiko_%28Tokyo_National_Museum%29.jpg

You should adjust the values in the list such that they suit *your* images.

I'm sorry for being so silly but that still doesn't make sense to me. Let's take this code:

<block myblock>
/ trials = [1-2 = mytrial]
</block>
<trial mytrial>
/ ontrialbegin = [picture.mypicture.width = list.widths.nextvalue;]
/ stimulusframes = [1=mypicture]
/ validresponse = (57)
</trial>
<picture mypicture>
/ items = myitems
/ height = 80%
/ width = 0%
/ position = (50%, 50%)
</picture>
<list widths>
/ items = (80%, 40%)
/ selectionmode = picture.mypicture.nextindex
</list>
<item myitems>
/ 1 = "01.jpg"
/ 2 = "02.jpg"
</item>
---------------------------------------------------------------------------------
For both items the hight is 80% of the screen right? And only the widths varies (80% for the first picture and 40% for the second picture)?
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 104K
JuliaJuliaJulia - Wednesday, February 6, 2019

I'm sorry for being so silly but that still doesn't make sense to me. Let's take this code:

<block myblock>
/ trials = [1-2 = mytrial]
</block>
<trial mytrial>
/ ontrialbegin = [picture.mypicture.width = list.widths.nextvalue;]
/ stimulusframes = [1=mypicture]
/ validresponse = (57)
</trial>
<picture mypicture>
/ items = myitems
/ height = 80%
/ width = 0%
/ position = (50%, 50%)
</picture>
<list widths>
/ items = (80%, 40%)
/ selectionmode = picture.mypicture.nextindex
</list>
<item myitems>
/ 1 = "01.jpg"
/ 2 = "02.jpg"
</item>
---------------------------------------------------------------------------------
For both items the hight is 80% of the screen right? And only the widths varies (80% for the first picture and 40% for the second picture)?

> For both items the hight is 80% of the screen right? And only the widths varies (80% for the first picture and 40% for the second picture)?

Yes. The height of the <picture> element is set to 80% here


<picture mypicture>
/ items = myitems
/ height = 80%
/ width = 0%
/ position = (50%, 50%)
</picture>

and nowhere is it changed. The width is set on a trial-by-trial basis here

<trial mytrial>
/ ontrialbegin = [picture.mypicture.width = list.widths.nextvalue;]
/ stimulusframes = [1=mypicture]
/ validresponse = (57)
</trial>

and it is sampled from the <list> element. Which value, i.e. width, the list returns depends on the picture item the trial will display.

Do keep in mind one thing: Inquisit will not, under any circumstances, distort the original image's dimensions. They will remain intact, i.e. Inquisit will not "stretch" an image just because you set an excessive width or height. I.e. suppose you have an image that is 400 pixels wide, and 300 pixels high, then -- not matter what you do, the 4:3 width/height ratio will always be preserved, even if you set the <picture> element's dimensions to something absurd like width = 5% & height = 90%.

Edited 5 Years Ago by Dave
JuliaJuliaJulia
JuliaJuliaJulia
Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)
Group: Forum Members
Posts: 24, Visits: 82
Dave - Wednesday, February 6, 2019
JuliaJuliaJulia - Wednesday, February 6, 2019

I'm sorry for being so silly but that still doesn't make sense to me. Let's take this code:

<block myblock>
/ trials = [1-2 = mytrial]
</block>
<trial mytrial>
/ ontrialbegin = [picture.mypicture.width = list.widths.nextvalue;]
/ stimulusframes = [1=mypicture]
/ validresponse = (57)
</trial>
<picture mypicture>
/ items = myitems
/ height = 80%
/ width = 0%
/ position = (50%, 50%)
</picture>
<list widths>
/ items = (80%, 40%)
/ selectionmode = picture.mypicture.nextindex
</list>
<item myitems>
/ 1 = "01.jpg"
/ 2 = "02.jpg"
</item>
---------------------------------------------------------------------------------
For both items the hight is 80% of the screen right? And only the widths varies (80% for the first picture and 40% for the second picture)?

> For both items the hight is 80% of the screen right? And only the widths varies (80% for the first picture and 40% for the second picture)?

Yes. The height of the <picture> element is set to 80% here


<picture mypicture>
/ items = myitems
/ height = 80%
/ width = 0%
/ position = (50%, 50%)
</picture>

and nowhere is it changed. The width is set on a trial-by-trial basis here

<trial mytrial>
/ ontrialbegin = [picture.mypicture.width = list.widths.nextvalue;]
/ stimulusframes = [1=mypicture]
/ validresponse = (57)
</trial>

and it is sampled from the <list> element. Which value, i.e. width, the list returns depends on the picture item the trial will display.

Do keep in mind one thing: Inquisit will not, under any circumstances, distort the original image's dimensions. They will remain intact, i.e. Inquisit will not "stretch" an image just because you set an excessive width or height. I.e. suppose you have an image that is 400 pixels wide, and 300 pixels high, then -- not matter what you do, the 4:3 width/height ratio will always be preserved, even if you set the <picture> element's dimensions to something absurd like width = 5% & height = 90%.

Hey Dave,

thanks so much for this explanation and your help! I didn't know that Inquisit doesn't distort the image's dimensions. Know everything makes completely sense too me!!!!!!

And it works!

Thanks and best,


Julia
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search