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

[ios] [image-manipulator] Fix issue when manipulating image with unsupported color space #21757

Merged
merged 1 commit into from
Mar 29, 2023

Conversation

mmmulani
Copy link
Contributor

Why

When using expo-image-manipulator to resize an image (https://docs.expo.dev/versions/latest/sdk/imagemanipulator/#methods), if the provided image is in a color space that iOS cannot output to, the manipulateAsync method will fail.

How

Accomplishes this with a simple code change of using the default device's RGB colorspace when the image's colorspace does not suffice.

Test Plan

Using this image: https://user-images.githubusercontent.com/192928/225686623-db8d4cb1-1d96-4345-8b9e-e4fbd1083e39.png
call

await ImageManipulator.manipulateAsync(attachment.uri,
  [{
    resize: attachment.height > attachment.width ? { height: 1500 } : { width: 1500 },
  }],
  {
    compress: 0.9,
  },
);

and the method should succeed.

Checklist

@mmmulani mmmulani requested a review from barthap as a code owner March 18, 2023 16:35
@expo-bot expo-bot added the bot: passed checks ExpoBot has nothing to complain about label Mar 18, 2023
@mmmulani
Copy link
Contributor Author

@lukmccall any chance I can get a review on this?

Copy link
Contributor

@lukmccall lukmccall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good ✅
Thanks for your contribution 🔥 and sorry for the late review.

@lukmccall lukmccall merged commit d81b052 into expo:main Mar 29, 2023
EvanBacon pushed a commit that referenced this pull request Apr 5, 2023
…pported color space (#21757)

# Why

When using expo-image-manipulator to resize an image (https://docs.expo.dev/versions/latest/sdk/imagemanipulator/#methods), if the provided image is in a color space that iOS cannot output to, the manipulateAsync method will fail.

# How

Accomplishes this with a simple code change of using the default device's RGB colorspace when the image's colorspace does not suffice.

# Test Plan

Using this image: https://user-images.githubusercontent.com/192928/225686623-db8d4cb1-1d96-4345-8b9e-e4fbd1083e39.png
call
```
await ImageManipulator.manipulateAsync(attachment.uri,
  [{
    resize: attachment.height > attachment.width ? { height: 1500 } : { width: 1500 },
  }],
  {
    compress: 0.9,
  },
);
```
and the method should succeed.



# Checklist

- [x] Documentation is up to date to reflect these changes (eg: https://docs.expo.dev and README.md).
- [x] Conforms with the [Documentation Writing Style Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
- [x] This diff will work correctly for `expo prebuild` & EAS Build (eg: updated a module plugin).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot: passed checks ExpoBot has nothing to complain about
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants