弃用jimp

This commit is contained in:
fofolee
2024-12-30 19:49:28 +08:00
parent 5e2994fe6d
commit 7a79d3a443
10 changed files with 225 additions and 1904 deletions

View File

@@ -145,6 +145,7 @@
</template>
<script>
import pictureCompress from "picture-compressor";
export default {
name: "PersonalizeMenu",
@@ -169,8 +170,9 @@ export default {
const file =
mode === "light" ? this.selectFileLight : this.selectFileDark;
if (!file) return;
const processedImage = await window.imageProcessor(file.path);
const processedImage = await this.compressingPic(
window.resolveFileToBase64(file.path)
);
if (mode === "light") {
this.$root.profile.backgroundImgLight = processedImage;
@@ -188,6 +190,16 @@ export default {
this.$root.profile.glassEffect = val;
this.$root.saveProfile();
},
async compressingPic(img) {
let compressedImage = await pictureCompress({
img: img,
width: 1280,
height: 720,
type: "jpg",
quality: 0.8,
});
return compressedImage.img;
},
},
};
</script>