mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-27 19:25:11 +08:00
RTCImageStoreManager uses NSData instead of UIImage
Summary: Hi, I'm currently building an app that changes metadata, does some resizes, maybe watermarking ...etc. I want to use RCTImageStoreManager to store the original image in memory and allow me to command different modifications from javascript as it gives me more flexibility. As RCTImageEditingManager does for example. But currently the RTCImageStoreManager uses UIImage to store the image, the problem is that UIImage losses metadata. So i suggest we change it to NSData. Additionally I added a method to remove an image from the store. A related PR can be found here https://github.com/lwansbrough/react-native-camera/pull/100. Closes https://github.com/facebook/react-native/pull/3290 Reviewed By: javache Differential Revision: D2647271 Pulled By: nicklockwood fb-gh-sync-id: e66353ae3005423beee72ec22189dcb117fc719f
This commit is contained in:
committed by
facebook-github-bot-2
parent
83c9741dc9
commit
2b657003b7
@@ -57,3 +57,12 @@ RCT_EXTERN UIImage *RCTDecodeImageWithData(NSData *data,
|
||||
CGSize destSize,
|
||||
CGFloat destScale,
|
||||
UIViewContentMode resizeMode);
|
||||
|
||||
/**
|
||||
* Convert an image back into data. Images with an alpha channel will be
|
||||
* converted to lossless PNG data. Images without alpha will be converted to
|
||||
* JPEG. The `quality` argument controls the compression ratio of the JPEG
|
||||
* conversion, with 1.0 being maximum quality. It has no effect for images
|
||||
* using PNG compression.
|
||||
*/
|
||||
RCT_EXTERN NSData *RCTGetImageData(CGImageRef image, float quality);
|
||||
|
||||
Reference in New Issue
Block a user