Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.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
Android 在react native中将两个映像合并为一个新映像_Android_Image_React Native_Merge_Combinations - Fatal编程技术网

Android 在react native中将两个映像合并为一个新映像

Android 在react native中将两个映像合并为一个新映像,android,image,react-native,merge,combinations,Android,Image,React Native,Merge,Combinations,我有两个独立的图像一个是从相机点击的主图像,另一个是我从gallery中选择的图像它是一个徽标,我需要将这两个图像合并成新图像,以便我可以将该图像保存到gallery中并在社交媒体上共享。我需要这样做,感谢您的帮助 <Image style={{width: width, height: height*.7}} source={{ uri: imageAdress }} /> <Image source={this.state.avatarSource}

我有两个独立的图像一个是从相机点击的主图像,另一个是我从gallery中选择的图像它是一个徽标,我需要将这两个图像合并成新图像,以便我可以将该图像保存到gallery中并在社交媒体上共享。我需要这样做,感谢您的帮助

<Image
    style={{width: width, height: height*.7}}
    source={{ uri: imageAdress }} />
<Image 
   source={this.state.avatarSource} 
   style={{width: 80, height: 80, position:'absolute', top: 20, left: 20}} />


这是我现在需要合并的两张图片。

我已经找到了我问题的答案。您可以为您的视图拍摄快照,这很简单,您可以将两个图像放在一个视图中,并对该视图进行快照。我使用这个插件

反应本机视图快照

这将允许您拍摄特定视图的快照 谢谢

例如,您可以使用:

RNImageTools.merge(
    [
        image1,
        image2,
        image3,
    ]
).then(({ uri, width, height }) => {
  // Sync with your app state
}).catch(console.error);
import ImagesCombineLibrary from 'react-native-images-combine';

ImagesCombineLibrary.combineImages([
  Image.resolveAssetSource(require('../images/test1.png')),
  Image.resolveAssetSource(require('../images/test2.png'))
]).then((base64) => {

});
RNImageTools.merge(
    [
        image1,
        image2,
        image3,
    ]
).then(({ uri, width, height }) => {
  // Sync with your app state
}).catch(console.error);