Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

rotate or flip image (blob)

it is possible an image (blob) rotate 180° or flip it horizontal?

  • i load an image from my resources folder
  • make a blob (.toBlob())
  • crop it with module from Kosso module@github.com
    (the image was crop from top left corner)
  • now I want to crop the picture from the bottom

my solution would be rotate the picture and use the module from Kosso again. how can i rotate a image blob?

— asked December 17th 2010 by ben roe
  • crop
  • flip
  • kosso
  • module
  • rotate
  • rotatiting
0 Comments

2 Answers

  • var win = Ti.UI.createWindow({
        // backgroundColor : '#666666'
        backgroundColor : 'white',
        // url : '1.js'
    });
    
    var t = Ti.UI.create2DMatrix();
    t = t.rotate(180);
    
    var a = Titanium.UI.createAnimation();
    a.transform = t;
    a.duration = 1000;
    
    //
    // TOP LEFT
    //
    var view1 = Titanium.UI.createView({
        backgroundColor : '#336699',
        top : 100,
    
        height : 150,
        width : 150,
        anchorPoint : {
            x : 0.5,
            y : 0.5
        }
    });
    win.add(view1);
    
    var topLeft = Titanium.UI.createButton({
        title : 'Top Left',
        height : 40,
        width : 200,
        top : 10,
        left : 10
    });
    
    topLeft.addEventListener('click', function() {
        view1.animate(a);
    });
    
    win.add(topLeft);
    
    win.open({
        modal : true
    });
    
    — answered April 13th 2012 by Mitul Bhalia
    permalink
    1 Comment
    • I voted you up because op did ask for 180 degree rotation, which you provided the perfect example code for.

      I'm still on the search for a simple image flip though sans animation.

      — commented November 21st 2013 by Dooley P
  • Any solution?

    — answered April 13th 2012 by Robert Tochman-Szewc
    permalink
    1 Comment
    • where you set the image i mean in imageview or view….?

      — commented April 13th 2012 by Mitul Bhalia
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.