status-mobile
status-mobile copied to clipboard
Reduce image sizes
fixes #20075
Summary
In this pr, we try to reduce the size of the images used especially in the onboarding process to help in reducing the size of the application.
This is just a sample of images. We could achieve much more space by simply reducing the size of all images. In this pr, all images with over 100kb in Ui2. Combine they had a sum total of 26mb and its been reduced to 7.2mb.
status: wip
Jenkins Builds
Click to see older builds (30)
| :grey_question: | Commit | :hash: | Finished (UTC) | Duration | Platform | Result |
|---|---|---|---|---|---|---|
| :heavy_check_mark: | 3b998eb385e9da3e347e5348e8854081a9a96876 | #1 | 2024-05-16 23:30:07 | ~5 min | tests |
:page_facing_up:log |
| :heavy_check_mark: | 3b998eb385e9da3e347e5348e8854081a9a96876 | #1 | 2024-05-16 23:30:39 | ~5 min | android-e2e |
:robot:apk :calling: |
| :heavy_check_mark: | 3b998eb385e9da3e347e5348e8854081a9a96876 | #1 | 2024-05-16 23:32:05 | ~7 min | android |
:robot:apk :calling: |
| :heavy_check_mark: | 3b998eb385e9da3e347e5348e8854081a9a96876 | #1 | 2024-05-16 23:33:29 | ~8 min | ios |
:iphone:ipa :calling: |
| :heavy_check_mark: | 351751f40384611224846b3c321624c15f51f6b1 | #2 | 2024-05-17 12:40:18 | ~4 min | tests |
:page_facing_up:log |
| :heavy_check_mark: | d02f6bdd7201f63bc60595395a2b8164e4df01b1 | #3 | 2024-05-17 12:46:48 | ~6 min | android-e2e |
:robot:apk :calling: |
| :heavy_check_mark: | d02f6bdd7201f63bc60595395a2b8164e4df01b1 | #3 | 2024-05-17 12:47:06 | ~6 min | android |
:robot:apk :calling: |
| :heavy_check_mark: | d02f6bdd7201f63bc60595395a2b8164e4df01b1 | #3 | 2024-05-17 12:47:18 | ~6 min | tests |
:page_facing_up:log |
| :heavy_check_mark: | d02f6bdd7201f63bc60595395a2b8164e4df01b1 | #3 | 2024-05-17 12:49:22 | ~9 min | ios |
:iphone:ipa :calling: |
| :heavy_check_mark: | 2cf4bbc421a27d9ce7c5c0b132ba29b8e15c763e | #4 | 2024-05-22 23:56:49 | ~4 min | tests |
:page_facing_up:log |
| :heavy_check_mark: | 2cf4bbc421a27d9ce7c5c0b132ba29b8e15c763e | #4 | 2024-05-22 23:58:40 | ~5 min | android-e2e |
:robot:apk :calling: |
| :heavy_check_mark: | 2cf4bbc421a27d9ce7c5c0b132ba29b8e15c763e | #4 | 2024-05-23 00:00:00 | ~7 min | android |
:robot:apk :calling: |
| :heavy_check_mark: | 2cf4bbc421a27d9ce7c5c0b132ba29b8e15c763e | #4 | 2024-05-23 00:01:07 | ~8 min | ios |
:iphone:ipa :calling: |
| :heavy_check_mark: | 8f03ac882a65ea9384775ada0d5b0a94ec142f32 | #6 | 2024-05-23 00:15:04 | ~4 min | tests |
:page_facing_up:log |
| :heavy_check_mark: | 8f03ac882a65ea9384775ada0d5b0a94ec142f32 | #6 | 2024-05-23 00:16:51 | ~6 min | android |
:robot:apk :calling: |
| :heavy_check_mark: | 8f03ac882a65ea9384775ada0d5b0a94ec142f32 | #6 | 2024-05-23 00:19:17 | ~8 min | ios |
:iphone:ipa :calling: |
| :heavy_check_mark: | 8f03ac882a65ea9384775ada0d5b0a94ec142f32 | #6 | 2024-05-23 00:19:34 | ~8 min | android-e2e |
:robot:apk :calling: |
| :heavy_check_mark: | 605c168fa61316d47977e41167228783c8bdb6b6 | #7 | 2024-05-24 12:09:20 | ~4 min | tests |
:page_facing_up:log |
| :heavy_check_mark: | 3540de4487d6fafccaedce59f248ff99c96b23c7 | #8 | 2024-05-24 12:16:05 | ~4 min | tests |
:page_facing_up:log |
| :heavy_check_mark: | 3540de4487d6fafccaedce59f248ff99c96b23c7 | #8 | 2024-05-24 12:17:58 | ~6 min | android-e2e |
:robot:apk :calling: |
| :heavy_check_mark: | 3540de4487d6fafccaedce59f248ff99c96b23c7 | #8 | 2024-05-24 12:20:40 | ~9 min | ios |
:iphone:ipa :calling: |
| :heavy_check_mark: | 3540de4487d6fafccaedce59f248ff99c96b23c7 | #8 | 2024-05-24 12:21:10 | ~9 min | android |
:robot:apk :calling: |
| :heavy_check_mark: | 98ad4cec724580b2be60c020f4f2bcaa6201170a | #9 | 2024-05-27 10:07:53 | ~4 min | tests |
:page_facing_up:log |
| :heavy_check_mark: | 98ad4cec724580b2be60c020f4f2bcaa6201170a | #9 | 2024-05-27 10:11:48 | ~8 min | android-e2e |
:robot:apk :calling: |
| :heavy_check_mark: | 98ad4cec724580b2be60c020f4f2bcaa6201170a | #9 | 2024-05-27 10:11:56 | ~8 min | android |
:robot:apk :calling: |
| :heavy_check_mark: | 98ad4cec724580b2be60c020f4f2bcaa6201170a | #9 | 2024-05-27 10:12:02 | ~8 min | ios |
:iphone:ipa :calling: |
| :heavy_check_mark: | 818a1e67bfd2efc9195581981e98707c421f9441 | #10 | 2024-05-29 10:06:40 | ~4 min | tests |
:page_facing_up:log |
| :heavy_check_mark: | 818a1e67bfd2efc9195581981e98707c421f9441 | #10 | 2024-05-29 10:09:39 | ~7 min | android |
:robot:apk :calling: |
| :heavy_check_mark: | 818a1e67bfd2efc9195581981e98707c421f9441 | #10 | 2024-05-29 10:11:25 | ~9 min | android-e2e |
:robot:apk :calling: |
| :heavy_check_mark: | 818a1e67bfd2efc9195581981e98707c421f9441 | #10 | 2024-05-29 10:16:02 | ~13 min | ios |
:iphone:ipa :calling: |
| :grey_question: | Commit | :hash: | Finished (UTC) | Duration | Platform | Result |
|---|---|---|---|---|---|---|
| :heavy_check_mark: | 069bbe2cb773fedac93b926213a71cb6fd4595e2 | #11 | 2024-05-29 11:15:23 | ~4 min | tests |
:page_facing_up:log |
| :heavy_check_mark: | 069bbe2cb773fedac93b926213a71cb6fd4595e2 | #11 | 2024-05-29 11:19:28 | ~8 min | android-e2e |
:robot:apk :calling: |
| :heavy_check_mark: | 069bbe2cb773fedac93b926213a71cb6fd4595e2 | #11 | 2024-05-29 11:19:36 | ~8 min | android |
:robot:apk :calling: |
| :heavy_check_mark: | 069bbe2cb773fedac93b926213a71cb6fd4595e2 | #11 | 2024-05-29 11:19:47 | ~8 min | ios |
:iphone:ipa :calling: |
| :heavy_check_mark: | 8574a63d87c15f3cfe0bfc80e6fde655282000c8 | #12 | 2024-05-29 12:14:38 | ~4 min | tests |
:page_facing_up:log |
| :heavy_check_mark: | 8574a63d87c15f3cfe0bfc80e6fde655282000c8 | #12 | 2024-05-29 12:16:03 | ~5 min | android |
:robot:apk :calling: |
| :heavy_check_mark: | 8574a63d87c15f3cfe0bfc80e6fde655282000c8 | #12 | 2024-05-29 12:17:40 | ~7 min | android-e2e |
:robot:apk :calling: |
| :heavy_check_mark: | 8574a63d87c15f3cfe0bfc80e6fde655282000c8 | #12 | 2024-05-29 12:20:02 | ~9 min | ios |
:iphone:ipa :calling: |
I also compared between the compressed versions of all images in both webp and png file formats and while in both case the quality was more or less the same the png(s) achieved a smaller size
uncompressed images
webp compressed images
png compressed images
Before compression ios
After compressing ios
there is difference in quality is too small to notice
@Francesca-G I did some work to compress these images, it would help in reducing the size of the application, i think this needs a design review to just be sure you are okay with the quality of the compression. have a look whenever you can
85% of end-end tests have passed
Total executed tests: 52
Failed tests: 6
Expected to fail tests: 2
Passed tests: 44
IDs of failed tests: 727230,702782,727229,702843,702807,702730
IDs of expected to fail tests: 703495,703503
Failed tests (6)
Click to expand
Class TestGroupChatMultipleDeviceMergedNewUI:
| 1. test_group_chat_join_send_text_messages_push, id: 702807 |
Device 1: Device 2: Device 3: |
Class TestWalletMultipleDevice:
| 1. test_wallet_send_asset_from_drawer, id: 727230 |
|
| 2. test_wallet_send_eth, id: 727229 |
|
Class TestCommunityMultipleDeviceMerged:
| 1. test_community_message_edit, id: 702843 |
Device 1: Device 2: |
Class TestOneToOneChatMultipleSharedDevicesNewUi:
| 1. test_1_1_chat_emoji_send_reply_and_open_link, id: 702782 |
Device 1: Device 2: |
| 2. test_1_1_chat_message_reaction, id: 702730 |
Device 1: Device 2: |
Expected to fail tests (2)
Click to expand
Class TestGroupChatMultipleDeviceMergedNewUI:
| 1. test_group_chat_mute_chat, id: 703495 |
[[Chat is not unmuted after expected time: https://github.com/status-im/status-mobile/issues/19627]] Device 1: Device 2: Device 3: |
Class TestCommunityOneDeviceMerged:
| 1. test_community_discovery, id: 703503 |
[[reason: [NOTRUN] Curated communities not loading, https://github.com/status-im/status-mobile/issues/17852]] |
Passed tests (44)
Click to expand
Class TestActivityCenterContactRequestMultipleDevicePR:
| 1. test_add_contact_field_validation, id: 702777 |
| Device sessions Device 1: Device 2: |
| 2. test_activity_center_contact_request_accept_swipe_mark_all_as_read, id: 702851 |
| Device sessions Device 1: Device 2: |
| 3. test_activity_center_contact_request_decline, id: 702850 |
| Device sessions Device 1: Device 2: |
Class TestDeepLinksOneDevice:
| 1. test_links_open_universal_links_from_chat, id: 704613 |
| Device sessions Device 1: |
| 2. test_links_deep_links, id: 702775 |
| Device sessions Device 1: |
Class TestActivityMultipleDevicePRTwo:
| 1. test_activity_center_mentions, id: 702957 |
| Device sessions Device 1: Device 2: |
| 2. test_activity_center_admin_notification_accept_swipe, id: 702958 |
| Device sessions Device 1: Device 2: |
Class TestCommunityOneDeviceMerged:
| 1. test_restore_multiaccount_with_waku_backup_remove_switch, id: 703133 |
| Device sessions Device 1: |
| 2. test_community_copy_and_paste_message_in_chat_input, id: 702742 |
| Device sessions Device 1: |
| 3. test_community_undo_delete_message, id: 702869 |
| Device sessions Device 1: |
| 4. test_community_navigate_to_channel_when_relaunch, id: 702846 |
| Device sessions Device 1: |
| 5. test_community_mute_community_and_channel, id: 703382 |
| Device sessions Device 1: |
Class TestWalletOneDevice:
| 1. test_wallet_add_remove_regular_account, id: 727231 |
| Device sessions Device 1: |
| 2. test_wallet_add_remove_watch_only_account, id: 727232 |
| Device sessions Device 1: |
Class TestActivityMultipleDevicePR:
| 1. test_navigation_jump_to, id: 702936 |
| Device sessions Device 1: Device 2: |
| 2. test_activity_center_reply_read_unread_delete_filter_swipe, id: 702947 |
| Device sessions Device 1: Device 2: |
Class TestCommunityMultipleDeviceMerged:
| 1. test_community_several_images_send_reply, id: 703194 |
| Device sessions Device 1: Device 2: |
| 2. test_community_one_image_send_reply, id: 702859 |
| Device sessions Device 1: Device 2: |
| 3. test_community_emoji_send_copy_paste_reply, id: 702840 |
| Device sessions Device 1: Device 2: |
| 4. test_community_mark_all_messages_as_read, id: 703086 |
| Device sessions Device 1: Device 2: |
| 5. test_community_contact_block_unblock_offline, id: 702894 |
| Device sessions Device 1: Device 2: |
| 6. test_community_edit_delete_message_when_offline, id: 704615 |
| Device sessions Device 1: Device 2: |
| 7. test_community_message_delete, id: 702839 |
| Device sessions Device 1: Device 2: |
| 8. test_community_message_send_check_timestamps_sender_username, id: 702838 |
| Device sessions Device 1: Device 2: |
| 9. test_community_links_with_previews_github_youtube_twitter_gif_send_enable, id: 702844 |
| Device sessions Device 1: Device 2: |
| 10. test_community_unread_messages_badge, id: 702841 |
| Device sessions Device 1: Device 2: |
Class TestOneToOneChatMultipleSharedDevicesNewUi:
| 1. test_1_1_chat_text_message_delete_push_disappear, id: 702733 |
| Device sessions Device 1: Device 2: |
| 2. test_1_1_chat_push_emoji, id: 702813 |
| Device sessions Device 1: Device 2: |
| 3. test_1_1_chat_non_latin_messages_stack_update_profile_photo, id: 702745 |
| Device sessions Device 1: Device 2: |
| 4. test_1_1_chat_edit_message, id: 702855 |
| Device sessions Device 1: Device 2: |
| 5. test_1_1_chat_send_image_save_and_share, id: 703391 |
| Device sessions Device 1: Device 2: |
| 6. test_1_1_chat_pin_messages, id: 702731 |
| Device sessions Device 1: Device 2: |
Class TestCommunityMultipleDeviceMergedTwo:
| 1. test_community_markdown_support, id: 702809 |
| Device sessions Device 1: Device 2: |
| 2. test_community_hashtag_links_to_community_channels, id: 702948 |
| Device sessions Device 1: Device 2: |
| 3. test_community_mentions_push_notification, id: 702786 |
| Device sessions Device 1: Device 2: |
| 4. test_community_leave, id: 702845 |
| Device sessions Device 1: Device 2: |
| 5. test_community_join_when_node_owner_offline, id: 703629 |
| Device sessions Device 1: Device 2: |
Class TestGroupChatMultipleDeviceMergedNewUI:
| 1. test_group_chat_pin_messages, id: 702732 |
| Device sessions Device 1: Device 2: Device 3: |
| 2. test_group_chat_send_image_save_and_share, id: 703297 |
| Device sessions Device 1: Device 2: Device 3: |
| 3. test_group_chat_reactions, id: 703202 |
| Device sessions Device 1: Device 2: Device 3: |
| 4. test_group_chat_offline_pn, id: 702808 |
| Device sessions Device 1: Device 2: Device 3: |
Class TestOneToOneChatMultipleSharedDevicesNewUiTwo:
| 1. test_1_1_chat_delete_via_long_press_relogin, id: 702784 |
| Device sessions Device 1: Device 2: |
| 2. test_1_1_chat_is_shown_message_sent_delivered_from_offline, id: 702783 |
| Device sessions Device 1: Device 2: |
| 3. test_1_1_chat_mute_chat, id: 703496 |
| Device sessions Device 1: Device 2: |
I used an online tool, tinypng.com. I could try do some more work see if i can get any better results with webp or avifs.
I think a script for this kind of thing would do better for any future use as the designs come
On Fri, 17 May 2024, 16:48 Icaro Motta, @.***> wrote:
@.**** approved this pull request.
@jo-mut https://github.com/jo-mut, could you share which commands you used to compress PNG files?
WebP should be smaller for the same quality, ~25% less, but I checked that for rasterized images it may not be the best format, which explains the results you reported. I could create smaller WebP files than the PNG ones, but they introduced too many artifacts to my liking, visibly worse than the PNGs. The AVIF format on the other hand generates significantly smaller files than WebP for the same quality, but they still generate visible artifacts to achieve the same file size as the PNGs you generated.
Ideally we should have a quick script to compress a list of files or a directory. This script would have been useful now and in future iterations. If the script is too much to ask, could you at least add the commands in the PR description you used to generate these files?
Great work! 🚀
— Reply to this email directly, view it on GitHub https://github.com/status-im/status-mobile/pull/20076#pullrequestreview-2063642861, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG27564M5YXHWELLL5OFBTDZCYKENAVCNFSM6AAAAABH3DW5MGVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDANRTGY2DEOBWGE . You are receiving this because you were mentioned.Message ID: @.***>
I think a script for this kind of thing would do better for any future use as the designs come
It would be very helpful @jo-mut to have a basic script because we will surely have to do this again. It will save us time if you could do that. And it would help others reproduce and play with parameters.
I could try do some more work see if i can get any better results with webp or avifs.
I already tried using imagemagick's convert tool and also with Gimp, but the results weren't as good. I think we can ignore WebP and AVIFs for rasterized images tbh. If we were compressing photos of people/places/etc it'd be a different story, they would destroy traditional JPEGs for example.
I just tried sharp, a Node lib, quite fast due to native implementation under the hood. I could get a PNG of 55kb instead of 70kb from tinypng with a decent quality. Here's an example of what we can achieve and automate. Here's the script:
const sharp = require("sharp");
sharp("[email protected]")
.png({
effort: 10,
quality: 50, // We can play with this number
compressionLevel: 9
palette: true // This is critical to lower file sizes
})
.toFile("[email protected] - compressed")
.then((info) => {
console.log("Image compression completed:", info);
})
.catch((err) => {
console.error("Error during image compression:", err);
});
Given the good results obtained by sharp in my previous comment, it would be better if we didn't merge yet because if these images are added to the repo just so we remove them soon the repo size will increase in size even more because git won't be able to reuse bytes.
Well, I'm just giving options @jo-mut. And this topic about image compression is something I did a ton in life, so that's why I tried to dig deeper in this PR.
@ilmotta I agree with you, no need to merge now. I can play with this sharp script. Let me see how much we can achieve if i convert all the images in Ui2
@ilmotta I agree with you, no need to merge now. I can play with this sharp script. Let me see how much we can achieve if i convert all the images in Ui2
Hi @jo-mut !
Have this sharp issue resolved yet?
@mariia-skrypnyk not yet, i will might take some more time to work on this. Am currently on time off. We can revisit on wednesday
Thanks @jo-mut ! Have a food day-off!
Just tag me and I'll be notified to test your PR.
@ilmotta
I am using the Script, and I applied it to all the images on theui2 folder irregardless of their size just to have even more compression but so far am not so sure about the quality on some of the images
on this the image quality property has the value set at 100 and the total size of the whole folder reduces to 9.1mb from 28mb, the quality looks better
its acceptable I think
the quality on this is not good at all and below 80, it gets even more poor in quality , some images of course are not that much noticeable but on this one it was quite pronounced. Also the folder reduced to 6mb.
Thanks for trying the different approach @jo-mut. At least now we know we have alternatives that would give competitive asset sizes compared to tinypng and which are open-source.
@ilmotta I think this is even better, the difference between this approach and tinypng if there is even any is hard to tell, the quality of images is pretty much the same and with the script it achieves even smaller sizes
This pr can be merged I will add the script to our codebase in a separate pr.
Thank you for the suggestion
@mariia-skrypnyk Hi maria. When you have some time you can take another look at this pr. Thank you
Please, rebase your PR. I will take a look at it as soon as I finish my current testing. Thanks!
Hey @jo-mut !
Thanks for your PR. A lot of work was done! I've started from iOS and as for me not a huge difference happened from then till now. But I do see the difference for Android. I think it was planned, I just wanted to leave my comment.
Going to move PR to @Francesca-G review as well.
@jo-mut You can merge your PR after creating followup @Francesca-G mentioned above 🙌.
@jo-mut You can merge your PR after creating followup @Francesca-G mentioned above 🙌.
https://github.com/status-im/status-mobile/issues/20243