Search code examples
luacoronasdkcropmasking

Corona: Image cropping


how to crop an image selected from camera roll in corona sdk?

I have tried masking following this tutorial but this gives me colored background with my cropped image on it. I need cropped image alone.


Solution

  • local localGroup = display.newGroup()
    
    local backGround = display.newImage(localGroup,"backGround.png")
    local imageForCrop = display.newImage(localGroup,"path.png")
    
    local mask = graphics.newMask("mask.png")
    
    localGroup:setMask(mask.png)
    
    --then Capture , or if you don't need to capture circle you can use easy the display.captureBounds(boundsData)