JimmyDaddy / react-native-image-marker

🙈Adding text or icon watermark to your image using React Native👀👀
https://jimmydaddy.github.io/react-native-image-marker/
MIT License
316 stars 93 forks source link

Generates inconsistent text size across different devices #202

Closed eliasljubec closed 7 months ago

eliasljubec commented 7 months ago

Describe the bug When generating images with text in them, the size of the text changes depending on what phone you use. I tried generating the same image with text on two different phones - an iPhone SE (3rd Generation) and an iPhone 15 Pro Max. The text turned out to be much bigger on the iPhone 15 Pro Max than on the iPhone SE which is strange, especially considering that the same parameters were used for generating the images.

To Reproduce Steps to reproduce the behavior:

Following code was used on both devices to generate the images shown below:

const image = await ImageMarker.markText({
    saveFormat: ImageFormat.jpg,
    backgroundImage: {
        src: 'https://images.unsplash.com/photo-1434281406913-47acccb03654?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wzMTA3Nzl8MHwxfHJhbmRvbXx8fHx8fHx8fDE3MDYwOTU2ODl8&ixlib=rb-4.0.3&q=80&w=1080',
        scale: 1,
    },
    watermarkTexts: [
        {
            text: 'Duis aute irure dolor in reprehenderit\n in voluptate velit esse cillum valum',
            positionOptions: {
                position: Position.center,
            },
            style: {
                color: '#fbfbfb',
                fontName: 'Arial-BoldMT',
                fontSize: 24,
                shadowStyle: {
                    dx: 3,
                    dy: 3,
                    radius: 6,
                    color: '#0000004f'
                },
                textAlign: 'left',
            }
        }
    ]
});

await MediaLibrary.saveToLibraryAsync(image);

Expected behavior In this case, I have set specific parameters for how the text should appear on the image, so the result should be consistent/identical regardless which devices was used to generate the image.

Screenshots iPhone 15 Pro Max iPhone 15 Pro Max

iPhone SE 3rd Gen iPhone SE 3gen

Devlopment environment:

Smartphone:

JimmyDaddy commented 7 months ago

Thank you for reporting this issue, I have found the cause of the issue and will fix it shortly.

eliasljubec commented 7 months ago

Thank you, much appreciated! I also noticed the same issue on android when using a Pixel 4 and a Pixel 4 XL.

JimmyDaddy commented 7 months ago

v1.2.4 is available

eliasljubec commented 7 months ago

Thanks @JimmyDaddy works!

pramahaditamaputra commented 4 months ago

Hi @JimmyDaddy how to solve this issue for project react native 0.72.x ? currently i'm using v1.1 in OS Android 14 the text size come more bigger i tried upgrade to v1.2.6 but its give me new error like this https://github.com/JimmyDaddy/react-native-image-marker/issues/183