import ImageMarker from "react-native-image-marker" 路路路 // add text watermark to a photo this.setState({ loading: true }) Marker.markText({ src: img.uri, text: 'text marker', X: 30, Y: 30, color: '#FF0000', fontName: 'Arial-BoldItalicMT', fontSize: 44, shadowStyle: { dx: 10.5, dy: 20.8, radius: 20.9, color: '#ff00ff' }, textBackgroundStyle: { type: 'stretchX', paddingX: 10, paddingY: 10, color: '#0f0' }, scale: 1, quality: 100 }).then((res) => { this.setState({ loading: false, markResult: res }) console.log("the path is"+res) }).catch((err) => { console.log(err) this.setState({ loading: false, err }) }) 路路路 this.setState({ loading: true }) Marker.markText({ src: img.uri, text: 'text marker', position: 'topLeft', color: '#FF0000', fontName: 'Arial-BoldItalicMT', fontSize: 44, scale: 1, quality: 100 }).then((res) => { console.log("the path is"+res) this.setState({ loading: false, markResult: res }) }).catch((err) => { console.log(err) this.setState({ loading: false, err }) }) // add icon watermark to a photo const iconUri = icon.uri const backGroundUri = img.uri this.setState({ loading: true }) Marker.markImage({ src: backGroundUri, markerSrc: iconUri, // icon uri X: 100, // left Y: 150, // top scale: 1, // scale of bg markerScale: 0.5, // scale of icon quality: 100 // quality of image }).then((path) => { this.setState({ uri: Platform.OS === 'android' ? 'file://' + path : path, loading: false }) }).catch((err) => { console.log(err, 'err') this.setState({ loading: false, err }) }) Marker.markImage({ src: backGroundUri, markerSrc: iconUri, position: 'topLeft', // topLeft, topCenter,topRight, bottomLeft, bottomCenter , bottomRight, center scale: 1, markerScale: 0.5, quality: 100 }).then((path) => { this.setState({ uri: Platform.OS === 'android' ? 'file://' + path : path, loading: false }) }).catch((err) => { console.log(err, 'err') this.setState({ loading: false, err }) }) // you can also add watermark to a photo with static images Marker.markImage({ src: backGroundUri, markerSrc: require('./icon.png'), position: 'topLeft', // topLeft, topCenter,topRight, bottomLeft, bottomCenter , bottomRight, center scale: 1, markerScale: 0.5, quality: 100 }).then((path) => { this.setState({ uri: Platform.OS === 'android' ? 'file://' + path : path, loading: false }) }).catch((err) => { console.log(err, 'err') this.setState({ loading: false, err }) }) // or base64 Marker.markImage({ src: { uri: `data:img/jpg;base64,/9j/4qqqAQSkZJRgABAQEBLAEsAAD/2wBDAAIBAQEBAQIBAQECAgICAgQDAgICAgUEBAMEBgUGBgYFBgYGBwkIBgcJBwYGCAsICQoKCgoKBggLDAsKDAkKCgr/2wBDAQICAgICAgUDAwUKBwYHCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgr/wAARCAHnAooDASIA AhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgddddcI` }, markerSrc: { uri: `data:img/jpg;base64,/9j/4AAQSkZJRgABAQEBLAEsAAD/2wBDAAIBAQEBAQIBAQECAgICAgQDAgICAgUEBAMEBgUGBgYFBgYGBwkIBgcJBwYGCAsICQoKCgoKBggLDAsKDAkKCgr/2wBDAQICAgICAgUDAwUKBwYHCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgr/wAARCAHnAooDASIA AhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcI` }, position: 'topLeft', // topLeft, topCenter,topRight, bottomLeft, bottomCenter , bottomRight, center scale: 1, markerScale: 0.5, quality: 100 }).then((path) => { this.setState({ uri: Platform.OS === 'android' ? 'file://' + path : path, loading: false }) }).catch((err) => { console.log(err, 'err') this.setState({ loading: false, err }) })