Edit: Solution posted below sample code:
No one is complaining about this, so I must be doing something really silly…hopefully someone can point it out for me:
Using:
media.show(media.PhotoLibrary, onComplete)
When I pick a full size photo, image resize (see below) is working perfectly, BUT it seems the img (being larger than iphone 4 display) has already rendered partially off-screen & so my scale {size1to2} func, happened on the TRUNCATED part of the pic
– my scaling code is running too late to get the whole pict?
In short, what’s being saved to disk is the SCALED bottom right corner of the whole picture.
Sample code:
[lua]local onComplete = function(v_event2)
local imgObj = v_event2.target
if not imgObj then – user hit cancel; load last image
return true
end
– print(‘imgObj.width=’…imgObj.width…’ imgObj.height=’…imgObj.height)
if imgObj.width ~= 84 or imgObj.height ~= 84 then
img.size1to2(imgObj, {84,84})
end – resize is working perfectly, BUT:
– it seems the img already rendered partially off-screen
– and so my scale {size1to2} func, happend on the TRUNCATED part of the pic
– ie too late
local group = newGroup()
group.x = 0
group.y = 0
group:insert(imgObj)
local filename = timestamp()
img.storeImg(group, filename) --now store it as a file in
imgObj:removeSelf() – destroy the image
loadPic(filename) – loads 84x84 truncated copy
end
media.show(media.PhotoLibrary, onComplete)[/lua]
Does anyone know how to work around this??
Oh nevermind…I just figured out what you guys are saying above about the next frame…my “scale” doesn’t happen until the next redraw and so I’m saving too soon.
Got it…I’ll try that now. [import]uid: 6175 topic_id: 12957 reply_id: 52890[/import]