numandev1 / react-native-compressor

🗜️Compress Image, Video, and Audio same like Whatsapp 🚀✨
MIT License
949 stars 93 forks source link

Manual Image Compress Options Doesn't Change Anything - iOS #287

Closed LCseniordev closed 5 months ago

LCseniordev commented 7 months ago

Current behavior

Different 'quality' param does not affect image compression for iOS. Working fine on Android.

Expected behavior

Different 'quality' props affect compression and results with different quality and size.

Platform

React Native Version

0.73.6

React Native Compressor Version

1.8.24

Reproducible Steps And Demo

Take any image from stock or default one from iOS simulator and compress with different 'quality' param.

const thumbnailPath1 = await Image.compress(url, {
  compressionMethod: 'manual',
  maxWidth: 1280,
  maxHeight: 1280,
  quality: 1,
});

const thumbnailPath2 = await Image.compress(url, {
  compressionMethod: 'manual',
  maxWidth: 1280,
  maxHeight: 1280,
  quality: 0.75,
});

const thumbnailPath3 = await Image.compress(url, {
  compressionMethod: 'manual',
  maxWidth: 1280,
  maxHeight: 1280,
  quality: 0.5,
});

const thumbnailPath4 = await Image.compress(url, {
  compressionMethod: 'manual',
  maxWidth: 1280,
  maxHeight: 1280,
  quality: 0.25,
});

const thumbnailPath5 = await Image.compress(url, {
  compressionMethod: 'manual',
  maxWidth: 1280,
  maxHeight: 1280,
  quality: 0.1,
});

console.log('1', await getFileSize(thumbnailPath1));
console.log('2', await getFileSize(thumbnailPath2));
console.log('3', await getFileSize(thumbnailPath3));
console.log('4', await getFileSize(thumbnailPath4));
console.log('5', await getFileSize(thumbnailPath5));

Log Result:

1 605016 2 605016 3 605016 4 605016 5 605016

github-actions[bot] commented 7 months ago

👋 @LCseniordev Thanks for opening your issue here! If you find this package useful hit the star🌟!

LCseniordev commented 7 months ago

In v1.6.3 it works as expected, so I had to rollback to this version, but now I'm missing EXIF data, that was fixed in newest releases.

rohinipf commented 6 months ago

I am experiencing this exact issue on iOS with v1.8.24 as well

Without rolling back to older version, is there another way around this issue?

LCseniordev commented 6 months ago

@rohinipf I had to switch to react-native-image-crop-picker to pick images, because has built-in compression, though not so effective. But I'm still using this package to compress video on Android, because react-native-image-crop-picker does not support it

rohinipf commented 5 months ago

@LCseniordev Thanks, will look into it.

numandev1 commented 5 months ago

released in 1.8.25