简体   繁体   English

如何旋转base64图像并将其保存为角度2或以上?

[英]How to rotate base64 image and save it in angular 2 or above?

I have used css for rotation effect我已经使用 css 来实现旋转效果

<img class="" [hidden]="cropperDisp2" [style.filter]="range" [@rotatedState]='state' (click)="testfun($event)" id="imgid" [src]="">

document.getElementById('imgid').setAttribute('src', this.imagePath);

Component({
selector: 'app-image-editor',
templateUrl: './image-editor.component.html',
animations: [
  // Each unique animation requires its own trigger. The first argument of the trigger function is the name
    trigger('rotatedState', [
        state('rotate0', style({
            transform: 'rotate(0)'
        })),
      // state('rotate1', style({ transform: 'rotate(-45deg)',width:'55%',height:'55%',marginTop:'14%',marginLeft:'25%' })),
        state('rotate2', style({
            transform: 'rotate(-90deg)'
        })),
      //  state('rotate3', style({ transform: 'rotate(-135deg)',width:'55%',height:'55%',marginTop:'14%',marginLeft:'25%'})),
        state('rotate4', style({
            transform: 'rotate(-180deg)'
        })),



      //  transition('rotated => rotate0', animate('1500ms ease-out')),
      //  transition('rotate0 => rotated', animate('400ms ease-in'))
    ])
],
styleUrls: ['./image-editor.component.css'] })

I think with css we cannot save the rotated image.Is there any alternate way to rotate it and save it ...i am sending base64 has data at service level.Thanks in advance...rotated base64 data will be gr8我认为使用 css 我们无法保存旋转的图像。有没有其他方法可以旋转它并保存它...我正在发送 base64 有服务级别的数据。提前致谢...旋转的 base64 数据将是 gr8

您可以在此处找到解决方案Stackblitz

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM