Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/406.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何旋转base64图像并将其保存在angular 2或更高版本中?_Javascript_Angular_Image_Image Editing - Fatal编程技术网

Javascript 如何旋转base64图像并将其保存在angular 2或更高版本中?

Javascript 如何旋转base64图像并将其保存在angular 2或更高版本中?,javascript,angular,image,image-editing,Javascript,Angular,Image,Image Editing,我已经使用css的旋转效果 document.getElementById('imgid').setAttribute('src',this.imagePath); 我认为使用css我们无法保存旋转后的图像。是否有其他方法可以旋转并保存它…我正在发送base64具有服务级别的数据。提前感谢…旋转后的base64数据将是gr8您可以在此处找到解决方案。为此目的使用画布。使用画布旋转并保存图像。下面是一个如何在画布上旋转图像的示例:您可以通过toDataURL保存图像-是否没有其他方法可以使用纯

我已经使用css的旋转效果

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


我认为使用css我们无法保存旋转后的图像。是否有其他方法可以旋转并保存它…我正在发送base64具有服务级别的数据。提前感谢…旋转后的base64数据将是gr8

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

为此目的使用
画布
。使用画布旋转并保存图像。下面是一个如何在画布上旋转图像的示例:您可以通过toDataURL保存图像-是否没有其他方法可以使用纯角度或角度api解决此问题--kosh和我还想增加图像的亮度/不透明度等,并将其保存……为此,我还动态地对视图进行css更改,但没有使用任何角度的方式。。。。
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'] })