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

High resolution image is rotated on ios after watermark #201

Closed StanislavMayorov closed 7 months ago

StanislavMayorov commented 7 months ago

Hello! Thank you for the library.

Describe the bug High resolution markText backgroundImage image 3024 × 4032 (from iphone XR camera, HEIC/jpg) is rotated after applying watermarkTexts. 605 × 806 image works okay.

To Reproduce Steps to reproduce the behavior:

  1. Use ios device
  2. Use example image and code below
    Marker.markText({
    backgroundImage: {
        src: image.uri,
        scale: 1,
    },
    watermarkTexts: [
        {
            text: 'test',
            positionOptions: {
                position: Position.center,
            },
            style: {
                color: '#ffffff80',
                fontSize: 40,
                textBackgroundStyle: {
                    color: '#F4A1A154',
                },
                textAlign: 'left',
            },
        },
    ],
    filename: image.name,
    saveFormat: ImageFormat.jpg,
    })

    Result: photo is rotated. result copy

Expected behavior Watermark applied and photo not rotated

Development environment:

Smartphone :

JimmyDaddy commented 7 months ago

@StanislavMayorov Sorry, I didn't repreduce this issue by your code and image, there is my test result:

const uri = await Marker.markText({
        backgroundImage: {
          src: require('./yahaha.jpeg'),
          scale: 1,
        },
        watermarkTexts: [
          {
            text: 'test',
            positionOptions: {
              position: Position.center,
            },
            style: {
              color: '#ffffff80',
              fontSize: 40,
              textBackgroundStyle: {
                color: '#F4A1A154',
              },
              textAlign: 'left',
            },
          },
        ],
        filename: image.name,
        saveFormat: ImageFormat.jpg,
      })

9A4460C1-D748-4722-88AA-E7003A645DCA

You can test it with the example project

Btw, can you provide a minimal reproduction for me?

StanislavMayorov commented 7 months ago

I can't reproduce the issue. I tried the latest and my versions of libs in the example project and I removed launchImageLibrary maxWidth: 2000, maxHeight: 2000. I can reproduce it only in my app when file:// path from react-native-image-picker is used . I logged urls and checked files in the file system in my app. Image is rotated just after Marker.markText.

    "react-native-image-marker": "1.1.11",
    "react-native-image-picker": "3.3.2",

So it's something wrong on my side. Thank you!

qq382724935 commented 6 months ago

iphone xs Encountering the same problem。

qq382724935 commented 6 months ago

version 1.1.15 RN version 0.71.14 ios version 14.6

qq382724935 commented 6 months ago

Marker.markText({ quality: options.quality, backgroundImage: { src: data.uri, scale: 1, }, watermarkTexts: [ { text: watermark, positionOptions: { position: Position.center, }, style: { color: '#FF0000', fontName: 'Arial-BoldItalicMT', fontSize: 88, shadowStyle: { dx: 0, dy: 0, radius: 0, color: '#0000FF', }, textBackgroundStyle: { type: TextBackgroundType.stretchX, paddingX: 0, paddingY: 0, color: '', }, }, }, ], }).then((image) => this.fileDataChange(file:///${image}));