numandev1/react-native-compressor

Manual Image Compress Options Doesn't Change Anything - iOS

LCseniordev opened this issue · 6 comments

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

  • iOS

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

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

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.

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?

@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

@LCseniordev Thanks, will look into it.

released in 1.8.25