Using image-js to generate images thumbnails (doesn't work well because of the lack of advanced interpolation methods in the current version)
This commit is contained in:
parent
15984a0d5d
commit
ee980f219b
|
@ -20,6 +20,7 @@ import {
|
|||
Encoding,
|
||||
} from '@capacitor/filesystem';
|
||||
import ExifReader from 'exifreader';
|
||||
import { Image } from 'image-js';
|
||||
|
||||
interface Props {
|
||||
file: File;
|
||||
|
@ -114,8 +115,14 @@ const ImportSingleFile: Component<Props> = ({ file: file }) => {
|
|||
}`;
|
||||
const id = exif?.ImageUniqueID?.value[0];
|
||||
const gps = tags.gps;
|
||||
const thumbnail = tags.Thumbnail;
|
||||
const thumbnailUrl = `data:${thumbnail?.type};base64,${thumbnail?.base64}`;
|
||||
const image = await Image.load(reader.result);
|
||||
const thumbnail = image.resize({
|
||||
width: 256,
|
||||
interpolation: 'bilinear',
|
||||
});
|
||||
const thumbnailUrl = thumbnail.toDataURL();
|
||||
// const thumbnail = tags.Thumbnail;
|
||||
//const thumbnailUrl = `data:${thumbnail?.type};base64,${thumbnail?.base64}`;
|
||||
console.log({
|
||||
caller: 'ImportSingleFile / Jpeg',
|
||||
file,
|
||||
|
|
Loading…
Reference in New Issue