-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
App Crashing on Mark Image (android) #230
Comments
@Muhammad19Omer did you find anything. i am also facing same. i am error like Error:null. Not much info. |
Hey @somasekharkakarla , unfortunately not. I’ve tried making a similar functionality by styling a watermark using an Image Background, and then using a View Shot to capture the View as a png, but I would really appreciate it if this bug gets fixed so I can just use the simpler solution. |
I have the same issue on Android using SDK 51. I would have to look for alternatives. |
SOLVED ✅Issue: Base64 Image Not Working on AndroidI encountered an issue where using a Base64 image directly in the SolutionI solved this issue by converting the Base64 string to a temporary file and then using the file path as the image source. This approach mimics the behavior of using an HTTP URL. Example CodeHere is the example code that demonstrates the solution: import Fs from 'react-native-fs';
if (cameraRef.current) {
const options = { quality: 0.6, base64: false };
const data = await cameraRef.current.takePictureAsync(options);
console.log('data', data);
const { uri } = await ImageResizer.createResizedImage(
data.uri,
640,
640,
'JPEG',
60
);
console.log('data.uri', data.uri);
console.log('uri', uri);
Fs.unlink(data.uri);
const selfie = await Fs.readFile(uri, 'base64');
Fs.unlink(uri);
const tempFilePath = `${Fs.TemporaryDirectoryPath}/selfie.jpg`;
await Fs.writeFile(tempFilePath, selfie, 'base64');
try {
const path = await ImageMarker.markImage({
backgroundImage: {
src: { uri: `file://${tempFilePath}` },
scale: 1,
},
watermarkImages: [
{
src: require('@/assets/images/watermark.png'),
scale: 0.5,
position: {
position: Position.bottomLeft,
},
},
],
quality: 100,
saveFormat: ImageFormat.base64,
});
console.log(path);
setUriTest(path);
} catch (err) {
console.log('error marking img: ', err);
}
} Explanation
This workaround resolves the issue with using Base64 images directly on Android by converting them into a format that is compatible with the image processing libraries. |
The problem is still here. Was working in old versions like "1.1.11". Not working in 1.2.6
Now only
|
Describe the bug
The app crashes (only on android) when the function Marker.markImage is called.
To Reproduce
Steps to reproduce the behavior:
const markedPhoto = await Marker.markImage({
saveFormat: ImageFormat.png,
backgroundImage: {
src: media.path,
scale: 1,
},
watermarkImages: [
{
src: logo,
position: {
position: Position.topLeft,
},
alpha: 0.5,
scale: 1.2
},
{
src: logo,
position: {
position: Position.bottomRight,
},
alpha: 0.5,
scale: 1.2
},
],
});
where media is the PhotoFile that is being marked.
Expected behavior
A marked image with the logo added to the top left and bottom right of the image.
Screenshots
Devlopment environment(please complete the following information):
Smartphone (please complete the following information):
Additional context
This only happens on Android, not on iOS.
The text was updated successfully, but these errors were encountered: