Skip to content

Why is the Skia image not displaying the same as the original image? #3015

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

Open
ralph1233 opened this issue Mar 12, 2025 · 2 comments
Open

Comments

@ralph1233
Copy link

`import {SafeAreaView, View, Image as RNImage, Text} from 'react-native';
import {Canvas, Image as SkiaImage, useImage} from '@shopify/react-native-skia';

const Test = () => {
const skiaImage = useImage(require('../../assets/images/human.jpeg'));

return (
<SafeAreaView
style={{
flex: 1,
}}>
<View
style={{
flex: 1,
alignItems: 'center',
}}>
Original Image:

    <RNImage
      style={{
        width: 300,
        height: 300,
      }}
      source={require('../../assets/images/human.jpeg')}
      resizeMode="contain"
    />

    <Text>Skia Image:</Text>

    <Canvas
      style={{
        width: 300,
        height: 300,
      }}>
      <SkiaImage width={300} height={300} image={skiaImage} fit="contain" />
    </Canvas>
  </View>
</SafeAreaView>

);
};

export default Test;
`

Image

@ralph1233 ralph1233 reopened this Mar 12, 2025
@NikitaDudin
Copy link
Contributor

Try to set sampling prop value to linear instead of nearest by default.

@ralph1233
Copy link
Author

Try to set sampling prop value to linear instead of nearest by default.

I added this line:

sampling={{
filter: FilterMode.Linear,
mipmap: MipmapMode.Linear,
}}
but it didn't work.

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

2 participants