Hi
I am trying to understand how display.save() calculates the image size to save. I have read the API docs but it seems to be behaving differently, or my understanding could also be wrong. I am using version 2013.1076 on Mac. I am including the test code below. My config.lua is setup for width = 320, height = 480, scale = “letterbox” and using landscape mode. I get the following results and sizes in Simulator for a group with width=100 and height=40:
iphone: 100, 40
iphone 4/4s: 100, 40
iphone 5: 100, 40
ipad: 107, 43
ipad Retina: 107, 43
driod: 150, 60
s3: 225, 90
…
I want to save the image in exact size (100,40).
Does someone know how it’s coming up with 107, 43 for iPad, for instance? Any insight is helpful.
thanks - Kay
local dir = system.TemporaryDirectory; local mw, mh = 100, 40; local fn="savetest2.png"; local grp = display.newGroup(); local gr = display.newRect(grp,0,0,mw,mh); display.save( grp, fn, dir); grp:removeSelf(); local img = display.newImage(fn, dir, 0,50, true); -- load full res no dynamic scaling local imgW = img.width; local imgH = img.height; print("file dims = " .. fn, imgW, imgH);