-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Investigate file size #598
Comments
I ran a quick experiment. I saw that Subject: [PATCH] Update API due to gravity change and ignore initial value changes, see https://github.com/phetsims/phet-core/issues/132
---
Index: js/common/loadFileAsDataURI.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/js/common/loadFileAsDataURI.js b/js/common/loadFileAsDataURI.js
--- a/js/common/loadFileAsDataURI.js (revision e7a7a9220537c15b3c80b580a52ad8f8aecdaed8)
+++ b/js/common/loadFileAsDataURI.js (date 1700143226939)
@@ -37,7 +37,13 @@
}
const base64 = `data:${mimeType};base64,${Buffer.from( fs.readFileSync( filename ) ).toString( 'base64' )}`;
- return base64;
+
+ if ( mimeType === 'image/png' ) {
+ return 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z/C/HgAGgwJ/lK3Q6wAAAABJRU5ErkJggg==';
+ }
+ else {
+ return base64;
+ }
}
module.exports = loadFileAsDataURI;
After building the sim with this patch, I see the new file size is 2.8MB. This evidence supports the hypothesis that the large file size is due to the sim-specific pngs. Therefore, we could investigate reducing the file size by reducing the number or resolution of images. Please see the notes in #498 where we previously discussed the image resolution and batch resizing. |
There is also an idea in phetsims/scenery#1578 about using SVG directly |
+1 for investigating phetsims/scenery#1578 to read .svg files directly. I posted in Slack#planning, and we discussed in #richtertillas standup meeting:
|
Related to #498, we saw that having a lot of high quality images and multiple variations led to an increased file size.
In the planning channel, @kathy-phet said:
@JacquiHayes also mentioned a request or report about file size, but I can't find that message.
The text was updated successfully, but these errors were encountered: