Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
media:crop(x,y,width,height) not working — Gideros Forum

media:crop(x,y,width,height) not working

AniketAniket Member
edited August 2014 in Plugins
I have code that uses the media plugin and it's basically like this.

local media = Media.new(e.path)
media:crop(100,100, 200, 200)
media:save()
local localTakenImage = Bitmap.new(Texture.new(e.path, true))
stage:addChild(localTakenImage)

This is not cropped at all, it's the full sized image. The e.path is what's in the path after I call Media:takeScreenshot()

The app is in landscape if that helps.

Comments

  • @Aniket media plugin creates copies of the files you edit (so you would not mess up a photo from photo album, and can revert back any time you want)

    so by reusing e.path, you are simply pointing to the same initial screenshot. Try:
    local localTakenImage = Bitmap.new(Texture.new(media:getPath(), true))
    ;)
  • AniketAniket Member
    edited August 2014
    @ar2rsawseen Oh my goodness, I knew I was doing something stupid. But still, I tried saving the path that e.path was giving me and the path that media:getPath() was giving me and it's the same!

    It threw me off because if I did a rotate or resize operation, a save was all that was needed.

    Now my code is:
    local media = Media.new(e.path)
    media:crop(x, y, width, height)
    media:save()
    local localTakenImage = Bitmap.new(Texture.new(media:getPath(), true))

    Rotate and resize work but crop does nothing.

    Also, though all paths are the same, the image is not actually there at that path. In the 'files' folder of an installed android application.
  • @ar2rsawseen any word on the crop function now? I rather need it for the current project I'm on.
  • @Aniket yes I can confirm that it is not working, not quite sure why right now.

    Unfortunately something messed with my set up and I can't build the plugin, not sure why, spend the day reinstalling the software and still nothing. I'll get back to you once I have something to report ;)
Sign In or Register to comment.