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

Image looses quality for some filters. #77

Open
manav-kasare opened this issue Aug 10, 2021 · 5 comments
Open

Image looses quality for some filters. #77

manav-kasare opened this issue Aug 10, 2021 · 5 comments

Comments

@manav-kasare
Copy link

manav-kasare commented Aug 10, 2021

  • For some filters we noticed that the image quality reduces.
  • Tested only on iOS. React-native: 0.64. react-native-image-filter-kit: 0.8.0
@iyegoroff
Copy link
Owner

Please provide reproducing example.

@manav-kasare
Copy link
Author

const extractedUri = React.useRef(uri); const onExtractImage = ({nativeEvent}) => { extractedUri.current = nativeEvent.uri; }; const onSelectFilter = (selectedIndex) => { setIndex(selectedIndex); };

This is the render function:
const renderFilterComponent = ({item, index}) => { const FilterComponent = item.filterComponent; const image = ( <Image style={filterStyles.filterSelector} source={{uri}} resizeMode={'contain'} /> ); return ( <TouchableOpacity style={{marginHorizontal: 15}} onPress={() => onSelectFilter(index)}> <FilterComponent image={image} /> <Text style={filterStyles.filterTitle}>{item.title}</Text> </TouchableOpacity> ); };

const SelectedFilterComponent = FILTERS[selectedFilterIndex].filterComponent;

This is what the component returns :
<SelectedFilterComponent onExtractImage={onExtractImage} extractImageEnabled={true} image={ <Image style={filterStyles.image} source={{uri}} resizeMode={'contain'} /> } />

@iyegoroff
Copy link
Owner

I need a minimal app that shows described behaviour, not just pieces of code.

@manav-kasare
Copy link
Author

I need a minimal app that shows described behaviour, not just pieces of code.

Is there a chance of filters lowering the image quality. If yes, how do I avoid it ?

@timothyerwin
Copy link

const extractedUri = React.useRef(uri); const onExtractImage = ({nativeEvent}) => { extractedUri.current = nativeEvent.uri; }; const onSelectFilter = (selectedIndex) => { setIndex(selectedIndex); };

This is the render function: const renderFilterComponent = ({item, index}) => { const FilterComponent = item.filterComponent; const image = ( <Image style={filterStyles.filterSelector} source={{uri}} resizeMode={'contain'} /> ); return ( <TouchableOpacity style={{marginHorizontal: 15}} onPress={() => onSelectFilter(index)}> <FilterComponent image={image} /> <Text style={filterStyles.filterTitle}>{item.title}</Text> </TouchableOpacity> ); };

const SelectedFilterComponent = FILTERS[selectedFilterIndex].filterComponent;

This is what the component returns : <SelectedFilterComponent onExtractImage={onExtractImage} extractImageEnabled={true} image={ <Image style={filterStyles.image} source={{uri}} resizeMode={'contain'} /> } />

this code is horribly formatted. please fix it.

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

No branches or pull requests

3 participants