perf: send still stickers at 256 pixels as palette PNGs, and say in the README who the app suits #17

Merged
dawid merged 1 commit from static-256 into main 2026-11-28 22:45:49 +00:00
Owner

Following the Talk team's feedback: a sticker has to be sent as a file, because Talk's phone apps
show a link only as a link card (tested). So this makes the file smaller, and says in the README
who the app suits.

Still stickers at 256 pixels

  • Before: animated and SVG stickers were already converted to at most 256 px. Still PNGs went
    as they are: Noto's 512 px, OpenMoji's 618 px.
  • Now: a still PNG or JPEG over 256 px is resized to 256 (StickerService::capped()).
    • Why palette PNGs: a full-colour PNG at 256 px is larger than Noto's optimised 512 px
      files (33–41 KB against 20–30 KB, measured). So a PNG becomes a palette PNG of 256 colours
      with soft transparency, as Noto's own are. A JPEG stays a JPEG.
    • When it stays as it is: when the result isn't smaller, when it's small already, or
      without Imagick. A shipped sticker is resized once and kept with the converted ones.
  • Measured on six real Noto stickers: 133 KB became 73 KB. The faces went from 20–30 KB to
    12–15 KB; the heart (5 KB) stayed as it was. Every person in the conversation loads the file,
    and Nextcloud's previews are made from it.
  • Quality: 0.4–1.1 % RMSE against a full-colour resize, with about 50 transparency levels.
    Side by side, the originals and the new files look the same.

README: who it suits

A new section Who it suits: families, clubs and small teams. Each sender needs a little free
storage, and in conversations of hundreds of people every sticker costs what an attachment costs.

Tests

  • SentSizeTest: a 512 px PNG and JPEG come out at 256 px, in their own format and smaller; a
    small image or a non-image is left alone. It runs with Imagick, in Nextcloud 35's image, and is
    skipped in CI's PHP image.
  • Psalm: the Imagick stub has the constant and the methods now used.
  • PHPUnit (26 tests), composer cs:check, markdownlint.
Following the Talk team's feedback: a sticker has to be sent as a file, because Talk's phone apps show a link only as a link card (tested). So this makes the file smaller, and says in the README who the app suits. ## Still stickers at 256 pixels - **Before:** animated and SVG stickers were already converted to at most 256 px. Still PNGs went as they are: Noto's 512 px, OpenMoji's 618 px. - **Now:** a still PNG or JPEG over 256 px is resized to 256 (`StickerService::capped()`). - **Why palette PNGs:** a full-colour PNG at 256 px is *larger* than Noto's optimised 512 px files (33–41 KB against 20–30 KB, measured). So a PNG becomes a palette PNG of 256 colours with soft transparency, as Noto's own are. A JPEG stays a JPEG. - **When it stays as it is:** when the result isn't smaller, when it's small already, or without Imagick. A shipped sticker is resized once and kept with the converted ones. - **Measured on six real Noto stickers:** 133 KB became 73 KB. The faces went from 20–30 KB to 12–15 KB; the heart (5 KB) stayed as it was. Every person in the conversation loads the file, and Nextcloud's previews are made from it. - **Quality:** 0.4–1.1 % RMSE against a full-colour resize, with about 50 transparency levels. Side by side, the originals and the new files look the same. ## README: who it suits A new section *Who it suits*: families, clubs and small teams. Each sender needs a little free storage, and in conversations of hundreds of people every sticker costs what an attachment costs. ## Tests - `SentSizeTest`: a 512 px PNG and JPEG come out at 256 px, in their own format and smaller; a small image or a non-image is left alone. It runs with Imagick, in Nextcloud 35's image, and is skipped in CI's PHP image. - Psalm: the Imagick stub has the constant and the methods now used. - PHPUnit (26 tests), `composer cs:check`, markdownlint.
perf: send still stickers at 256 pixels as palette PNGs, and say in the README who the app suits
All checks were successful
CI / php (dev-master) (pull_request) Successful in 1m35s
CI / php (dev-stable32) (pull_request) Successful in 1m29s
CI / php (dev-stable33) (pull_request) Successful in 1m25s
CI / php (dev-stable35) (pull_request) Successful in 1m30s
CI / php (dev-stable34) (pull_request) Successful in 1m30s
CI / standards (pull_request) Successful in 1m32s
CI / server (32) (pull_request) Successful in 2m5s
CI / javascript (pull_request) Successful in 36s
CI / server (35) (pull_request) Successful in 2m20s
64e7645910
dawid merged commit 64288a9d41 into main 2026-11-28 22:45:49 +00:00
dawid deleted branch static-256 2026-11-28 22:45:49 +00:00

Tests of CI / php (dev-master): passed

21 passed, 0 failed, 5 skipped (26 tests, 0.1 s)

Of 64e7645910, the run, updated by every run.

<!-- ci-report tests: CI-php-dev-master- --> ### Tests of CI / php (dev-master): passed **21 passed, 0 failed, 5 skipped** (26 tests, 0.1 s) <sub>Of 64e7645910, [the run](https://git.ciepiela.org/dawid/nextcloud-talk-stickers/actions/runs/122), updated by every run.</sub>

Tests of CI / php (dev-stable32): passed

21 passed, 0 failed, 5 skipped (26 tests, 0.1 s)

Of 64e7645910, the run, updated by every run.

<!-- ci-report tests: CI-php-dev-stable32- --> ### Tests of CI / php (dev-stable32): passed **21 passed, 0 failed, 5 skipped** (26 tests, 0.1 s) <sub>Of 64e7645910, [the run](https://git.ciepiela.org/dawid/nextcloud-talk-stickers/actions/runs/122), updated by every run.</sub>

Tests of CI / php (dev-stable33): passed

21 passed, 0 failed, 5 skipped (26 tests, 0.1 s)

Of 64e7645910, the run, updated by every run.

<!-- ci-report tests: CI-php-dev-stable33- --> ### Tests of CI / php (dev-stable33): passed **21 passed, 0 failed, 5 skipped** (26 tests, 0.1 s) <sub>Of 64e7645910, [the run](https://git.ciepiela.org/dawid/nextcloud-talk-stickers/actions/runs/122), updated by every run.</sub>

Tests of CI / php (dev-stable34): passed

21 passed, 0 failed, 5 skipped (26 tests, 0.1 s)

Of 64e7645910, the run, updated by every run.

<!-- ci-report tests: CI-php-dev-stable34- --> ### Tests of CI / php (dev-stable34): passed **21 passed, 0 failed, 5 skipped** (26 tests, 0.1 s) <sub>Of 64e7645910, [the run](https://git.ciepiela.org/dawid/nextcloud-talk-stickers/actions/runs/122), updated by every run.</sub>

Tests of CI / php (dev-stable35): passed

21 passed, 0 failed, 5 skipped (26 tests, 0.0 s)

Of 64e7645910, the run, updated by every run.

<!-- ci-report tests: CI-php-dev-stable35- --> ### Tests of CI / php (dev-stable35): passed **21 passed, 0 failed, 5 skipped** (26 tests, 0.0 s) <sub>Of 64e7645910, [the run](https://git.ciepiela.org/dawid/nextcloud-talk-stickers/actions/runs/122), updated by every run.</sub>
Sign in to join this conversation.
No description provided.