#### Howdy, Stranger!

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

# When creating a universal app, what is the best way to handle full screen pictures.

edited August 2014 Posts: 24

When creating a universal app, what is the best way to handle full screen pictures. Al my photos are 1024x768 and of course look stretched on the iPhone 5 and smashed on the 4s. is there a way to not stretch them? what are your best recommendations? Thanks

Tagged:

• Posts: 24

Right now I am using WIDTH and HEIGHT to set there size, which makes them fit but stretched them.

• Posts: 1,595

@swiftjuan you want to use ratios, the best way I can think of to do this would be (assuming you have the WIDTH and HEIGHT values for all devices, also this may not work thinking about it):

``````photosize = vec2(1024x768):normalize()
photosize = photosize*vec2(WIDTH,HEIGHT):len()
``````

Or you could do that but only multiply it by the HEIGHT value if in landscape or the WIDTH value if it portrait.

• Posts: 24

A bit lost here. Can you give me an example for the iPhone 5 1136x640? The images are 1024x768 and look great on the iPad. i get a user data error when i try to use photosioze for height and width. Obviously I an not gett ing back a number, but a string i don't know how to convert to a number.

• Posts: 24
``````   ~ if deviceIsIpad() then
bgW = WIDTH
bgH = HEIGHT
else
imageActualW = 1024
imageActualH = 768

local x = WIDTH / imageActualW - 1
bgW = WIDTH *.75
bgH = (imageActualH * x + imageActualH) * .75
--print(x)
--print(imageW)
--print(imageH)
end~
``````
• Mod
Posts: 3,297
``````tonumber(str)
``````
• edited September 2014 Posts: 2,043
``````ratioX, ratioY = WIDTH / 1024, HEIGHT / 768

bgW, bgH = WIDTH * ratioX, HEIGHT * ratioY
``````
• Posts: 24

^ i will try that. my brain is telling me that that will skew the image. i might need a new brain