Advanced Search

Page 3 of 3 FirstFirst 123
Results 21 to 25 of 25

Thread: Rotate an Image 90° or 180° ?

  1. #21
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    27,641
    Thanks
    42
    Thanked 2,897 Times in 2,869 Posts
    Blog Entries
    12

    Default

    The canvas tag is incredibly versatile, but the IE DXImageTransform.Microsoft.BasicImage filter isn't, at least not in the same way. They were meant for two almost entirely different purposes. With canvas and a good working knowledge of math and geometry, just about any type of angular, and/or scaling, and/or certain effects are possible, but it was meant primarily for drawing. With BasicImage, the effects are more straightforward, requiring less math, but are more limited I think. There are other filters for other effects. Angular rotation might be possible, I haven't researched it enough to know for sure yet.

    Edit: Oh, Oh, the IE progid:DXImageTransform.Microsoft.Matrix filter can do rotations in 1 degree increments.
    Last edited by jscheuer1; 12-18-2007 at 02:50 AM. Reason: add info
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  2. #22
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,484
    Thanks
    4
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Well, you beat me to it John. I guess I can knock that one off my challenge-to-do list

    But at least I stood by my word that JS could do it
    {CWoT - Riddle } {OSTU - Psycho} {Invasion - Team}
    Follow Me on Twitter: @Negative_Chaos
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  3. #23
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    27,641
    Thanks
    42
    Thanked 2,897 Times in 2,869 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by BLiZZaRD View Post
    Well, you beat me to it John. I guess I can knock that one off my challenge-to-do list

    But at least I stood by my word that JS could do it
    Yep, I won the race, but lost the argument. Anyways, I found a fudge to fix the ugly way FF does this. It distorts the image slightly (stretches it by 1px vertically), but is preferable in most cases to having a noticeable 1px slice of the image removed (addition red):

    Code:
    context.drawImage(im, 0, 0, c.width, c.height+1);
    This also distorts the image slightly in Opera & Safari, but the trade-off may be worth it. I'm thinking there must be a better way though, I'll keep looking for a bit, the canvas tag is very complex.

    Perhaps starting with the canvas 1px too sort might do it.

    Edit: Nope, just tried it, no good, it changes the layout height of the canvas, doh!
    Last edited by jscheuer1; 12-18-2007 at 04:15 PM. Reason: add info
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  4. #24
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,484
    Thanks
    4
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Job well done, as always John. Bravo
    {CWoT - Riddle } {OSTU - Psycho} {Invasion - Team}
    Follow Me on Twitter: @Negative_Chaos
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  5. #25
    Join Date
    Jan 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi John

    i have tested your code for flip, it works great. I also need to do it for left right rotation. I ahve managed to chaneg the script so that it can rotate left right, it works on IE but doesnt in firefox. IN firefox it still flip top bottom.

    I changed it to
    Code:
    im.style.filter+='progid:DXImageTransform.Microsoft.BasicImage(mirror=1)';
    }
    else{
    
    im.filters[flip[im.id]].mirror=im.filters[flip[im.id]].mirror==1? 0 : 1;
    }
    I believe the if else is refering to different browser option. Sorry if i got it wrong. Is there anyway i can make it flip left right as the Microsoft.BasicImage(mirror=1) only workd for IE.

    I am all lost on this server side image rotation and flipping.
    Thanks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •