Compare commits
3 Commits
main
...
1323dfa8c7
| Author | SHA1 | Date | |
|---|---|---|---|
| 1323dfa8c7 | |||
| 38cc09e7e9 | |||
| c953a3be71 |
@@ -96,39 +96,26 @@ async function addFiles(files) {
|
||||
try {
|
||||
let image = await loadImage(URL.createObjectURL(file));
|
||||
|
||||
/* let width = image.width;
|
||||
let width = image.width;
|
||||
let height = image.height;
|
||||
const MIN = 64, MAX = 2048;
|
||||
const MIN = 64, MAX = 512; // VRChat API will accept and store images up to 2048x2048, but the game seems to resize everything to 512x512.
|
||||
let aspectRatio = width / height;
|
||||
if (aspectRatio < (MIN/MAX) || aspectRatio > (MAX/MIN)) throw new Error("Invalid aspect ratio");
|
||||
if (height > width) {
|
||||
if (height > MAX) {
|
||||
height = MAX;
|
||||
width = height * aspectRatio;
|
||||
}
|
||||
if (width < MIN) {
|
||||
width = MIN;
|
||||
height = width * (1/aspectRatio);
|
||||
}
|
||||
height = Math.max(MIN, Math.min(MAX, height));
|
||||
width = height * aspectRatio;
|
||||
} else {
|
||||
if (width > MAX) {
|
||||
width = MAX;
|
||||
height = width * (1/aspectRatio);
|
||||
}
|
||||
if (height < MIN) {
|
||||
height = MIN;
|
||||
width = height * aspectRatio;
|
||||
}
|
||||
} */
|
||||
|
||||
// Although VRChat will store the original image within 64-2048px, it looks like the game resizes it to 512x512.
|
||||
let width = 512, height = 512;
|
||||
width = Math.max(MIN, Math.min(MAX, width));
|
||||
height = width * (1/aspectRatio);
|
||||
}
|
||||
let largestDim = Math.max(width, height);
|
||||
let offsetX = (largestDim - width) / 2;
|
||||
let offsetY = (largestDim - height) / 2;
|
||||
|
||||
let canvas = document.createElement("canvas");
|
||||
canvas.width = width;
|
||||
canvas.height = height;
|
||||
canvas.width = largestDim;
|
||||
canvas.height = largestDim;
|
||||
let ctx = canvas.getContext("2d");
|
||||
ctx.drawImage(image, 0, 0, width, height);
|
||||
ctx.drawImage(image, offsetX, offsetY, width, height);
|
||||
let data = canvas.toDataURL();
|
||||
URL.revokeObjectURL(image.src);
|
||||
let e = {
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"manifest_version": 3,
|
||||
"name": "VRChat Emoji Manager",
|
||||
"version": "1.2023.11.1",
|
||||
"description": "Store more than 5 emoji, toggle them on and off and change their animation styles.",
|
||||
"version": "1.2024.10.7",
|
||||
"description": "Store more than 9 emoji, toggle them on and off and change their animation styles.",
|
||||
"homepage_url": "https://gitea.moe/lamp/vrchat-emoji-manager",
|
||||
"icons": {
|
||||
"128": "icon128.png"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# VRChat Emoji Manager
|
||||
|
||||
VRChat Plus has a custom emoji feature but it is limited to 5 emojis and you cannot change their animation styles. This Chrome extension allows you to have a much larger collection of emojis and conveniently toggle them on and off when needed.
|
||||
VRChat Plus has a custom emoji feature but it is limited to 9 emojis and you cannot change their animation styles. This Chrome extension allows you to have a much larger collection of emojis and conveniently toggle them on and off when needed.
|
||||
|
||||

|
||||
|
||||
|
||||
Reference in New Issue
Block a user