Skip to content
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

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

Closed
1 task done
LCseniordev opened this issue Apr 24, 2024 · 6 comments
Closed
1 task done

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

LCseniordev opened this issue Apr 24, 2024 · 6 comments

Comments

@LCseniordev
Copy link

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

Copy link

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

@LCseniordev
Copy link
Author

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
Copy link

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
Copy link
Author

@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
Copy link

@LCseniordev Thanks, will look into it.

@numandev1
Copy link
Owner

released in 1.8.25

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants