-
|
I having trouble to read .heic image with Skia. How to solve it? const data = await Skia.Data.fromURI('path/to/image.heic');
const image = Skia.Image.MakeImageFromEncoded(data);Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
|
Have you found a way to solve this problem? I also encountered the same problem. |
Beta Was this translation helpful? Give feedback.
-
|
It's temporary solutions import {Skia, ImageShader, SkImage, DataSourceParam, useImage} from '@shopify/react-native-skia';
import {SaveFormat, manipulateAsync} from 'expo-image-manipulator';
import {useEffect, useState} from 'react';
import {useCanvasStore} from './context/canvas';
type Props = {
file: DataSourceParam;
};
export const NextImage = ({file}: Props) => {
const {width, height} = useCanvasStore();
const defaultImage = useImage(file);
const [image, setImage] = useState<SkImage>(defaultImage);
useEffect(() => {
if (!defaultImage && typeof file === 'string') {
manipulateAsync(file, [], {
compress: 0.8,
format: SaveFormat.JPEG,
}).then(async ({uri}) => {
const skData = await Skia.Data.fromURI(uri);
const skImage = Skia.Image.MakeImageFromEncoded(skData);
setImage(skImage);
});
}
}, [defaultImage, file]);
if (!image) {
return null;
}
return <ImageShader fit="contain" image={image} rect={{x: 0, y: 0, width, height}} />;
};
|
Beta Was this translation helpful? Give feedback.
-
|
hi @wcandillon any updates on this? |
Beta Was this translation helpful? Give feedback.
-
|
Need this as well, @wcandillon 🙏 |
Beta Was this translation helpful? Give feedback.
It's temporary solutions
If you convert image format to jpeg
It works