I didn’t found solution yet.
My goal is to implement an Image and then a Blur class not linked to a react native component.
It must take an uri in input and return an output uri of the modify image.
So the goal is to be able to read an image, iterate pixels, modify them, rebuild an image.
All that if possible without using too much external libraries.
I made several tests but always an echec.
For exemple, this do not read the pixels:
class Image{
constructor(src){
this.src = src
this.datas = null
}
async load(){
try {
console.log('Fetching image from:', this.src);
const response = await fetch(this.src);
console.log('response',response)
const blob = await response.blob();
const reader = new FileReader();
return new Promise((resolve, reject) => {
reader.onload = () => {
const buffer = reader.result;
this.datas = new Uint8Array(buffer);
console.log('Image loaded successfully');
resolve();
};
reader.onerror = (error) => {
console.error('Error during FileReader operation:', error);
reject(error);
};
console.log('Starting to read image blob');
reader.readAsArrayBuffer(blob);
});
} catch (error) {
console.error('Error loading image:', error);
}
}
Thank you in advance for your help.