Hi Coronas,
I am stuck while trying to use a freshly imported image from camera roll instead of the included image…
How do I resize the image from e.g. 1000x1000 pixels down to e.g. 100x100 pixels. Not only scale it, but really reduce the size. Example: I’d like to replace an image inside a physics body with another one taken from the camera roll. The image is scaled by using xScale and yScale, but the physics boundary will use the original size from the camera roll-picture.

I used the great Ragdoll-example from here: http://developer.anscamobile.com/forum/2010/10/29/new-corona-any-radgoll-examples
This is the Listener that gets called when issuing the camera roll.
[lua]function onComplete ( event )
if (event.target ~= nil) then
local photo = event.target
xscale = (display.contentWidth / photo.width ) / (display.contentWidth / head.width)
yscale = (display.contentHeight / photo.height ) / (display.contentHeight / head.height)
w = head.width
h = head.height
x = head.x
y = head.y
head:removeSelf()
head = nil
head = photo
head.myName = “head”
head.x = x
head.y = y
–[[ Here sits the problem. If you use the scale-portion, the physics will work, but it will only display a part of the image (the center part). If you comment out the width/height, the image will be right-sized, but the physics size will be the full size of the camera roll-image.
]]
head.xScale = xscale
head.yScale = yscale
– head.width = w
– head.height = h
doll:insert (head)
physics.addBody (head, {bounce = 0.0, friction = 1.0})
doll:addFrictionJoint(head, torsoA, torsoA.x, torsoA.y, -22.5, 22.5)
head:addEventListener ( “touch”, doll )
end
end[/lua]
Any help is highly appreciated 
Cheers,
Jörg [import]uid: 10612 topic_id: 11129 reply_id: 311129[/import]
