Repository navigation
Image: play animated images correctly, and optionally decode images at the size they're drawn at - #1296
Merged
Conversation
kevinaboos
force-pushed
the
image_animation_and_memory
branch
from
October 8, 2026 19:14
7bbdd42 to
bbdb0b0
Compare
kevinaboos
marked this pull request as ready for review
October 8, 2026 19:14
* New default `ImageAnimation::Natural`: each frame shows for its own delay, on one shared clock so same-rate animations share a repaint, and it stops while off screen * `size_in_pixels` returns the frame size instead of the whole sprite sheet's * Restore `image_scale`/`image_pan` after an animation, so a reused `Image` doesn't crop * Fix animated WebP disposal and APNG compositing/delays, and pack atlases tightly * Skip reloading an image that's already loading or showing; add `is_animated_image()` * A drawn `Image` catches up on a decode or animation tick it missed, e.g., in a closed modal
Every `Image` decoded its image at full size, so a big photo drawn as a small thumbnail kept all of its pixels in memory, on both the CPU and the GPU. * New `downscale_to_drawn_size`: an `Image` decodes its data once it's drawn, halving it like a mip level down to the drawn size, and decodes it again only if it's later drawn bigger * Shrunk textures keep their image's natural size, so layout and `size_in_pixels` don't change * The cache keeps one decode per key and only reuses it for requests it has enough pixels for * `image_size_by_data` now returns the size after EXIF orientation, like the decoded image * `evict_image_from_cache` also releases the GPU copy, and keeps pixels still waiting to be uploaded
kevinaboos
force-pushed
the
image_animation_and_memory
branch
from
October 8, 2026 19:19
bbdb0b0 to
8536d78
Compare
kevinaboos
added a commit
to project-robius/robrix
that referenced
this pull request
Oct 8, 2026
Animated GIFs, WebP and APNG images (aka "stickers" in matrix) were blank in the timeline, even though we added support for them in Makepad a few months ago. The issues were that we were asking for non-animated thumbnails (so just the first frame), which is often just blank or empty; also, the imageviewer was stretching them. Now we do the following: * Request animated thumbnails of the original file, or fetch the original file in full if the server only has a non-aniamted thumbnail to give us * Decode timeline images at the size they're drawn at, rather than their full size, which is way more memory efficient (and also more performant) * this also lets us remove the 1MiB size cap * Free a timeline's decoded images when the timeline is closed, and same for the imageviewer * Clicking an image now always opens (and downloads) the original rather than its thumbnail (but still shows the thumbnail at first) * Various makepad improvements to make all of this work, see makepad/makepad#1296 * Also modify our `ruma` fork to support the unstable `is_animated` field on media files, which is an experimental thing that ELement also does
ymote
added a commit
to OctoSense-org/makepad
that referenced
this pull request
Oct 9, 2026
Adapt makepad#1296 (95e0ad5) to this fork. Preserve async eviction recovery and error reporting; omit slice-image options absent in this widget API.
makepaddev
added a commit
that referenced
this pull request
Nov 26, 2026
41 files, +2318 -202. Areas: platform/src, platform/network, platform/video, libs/remote, platform/Cargo.toml, platform/hal, platform/tests. Part 4 of 14 of work tip 67c2fe0d87 (with commercial 12ff43bfc0). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Co-Authored-By: Codex <267193182+codex@users.noreply.github.com> Co-Authored-By: MarcWeber <34086+MarcWeber@users.noreply.github.com> Co-Authored-By: dotfrizzy <128760145+dotfrizzy@users.noreply.github.com> Co-Authored-By: kevinaboos <1139460+kevinaboos@users.noreply.github.com> Co-Authored-By: makepaddev <20386332+makepaddev@users.noreply.github.com> Co-Authored-By: moorbrook <619+moorbrook@users.noreply.github.com> Co-Authored-By: userRGH <49447120+userRGH@users.noreply.github.com> Co-Authored-By: wheregmis <26774729+wheregmis@users.noreply.github.com> Co-Authored-By: ymote <151983+ymote@users.noreply.github.com> Contributors: alanpoon (#770, #1083, #1096), athxx (#1138), CupOfOwls (#804), ddd-mtl (#1124), dotfrizzy (#786), Drin (#793), Edward Tan (#1090), Guocork (#742, #748), jason-yau (#841, #924, #926, #944, #953, #1148, #1155, #1168, #1169, #1183, #1184, #1219), Julián Montes de Oca (#764, #769, #790-#792, #798, #801, #803, #805, #807, #808, #811, #821, #833, #834, #836, #838, #839, #852, #857, #860, #863, #867), kevinaboos (#780, #819, #844, #846, #956, #977, #979, #987, #988, #990, #998, #1000, #1001, #1005, #1013, #1015, #1017, #1020, #1022, #1024, #1025, #1030, #1034-#1036, #1042, #1043, #1047, #1063, #1069, #1072, #1074-#1077, #1079, #1081, #1082, #1084-#1087, #1091, #1098, #1100, #1101, #1103, #1105-#1107, #1109, #1110, #1113, #1120, #1121, #1127, #1139, #1144, #1151, #1154, #1159, #1166, #1167, #1170, #1171, #1175, #1178, #1187, #1188, #1195-#1198, #1200, #1201, #1209, #1212, #1215, #1216, #1224, #1225, #1227, #1228, #1232, #1236, #1237, #1239, #1243-#1245, #1247, #1251, #1252, #1255, #1264, #1276, #1277, #1279, #1285, #1288, #1291, #1293, #1296, #1300, #1301, #1304, #1305, #1308, #1309, #1315, #1317, #1318, #1338, #1339, #1341, #1349, #1351, #1361-#1363, #1370-#1375, #1377, #1380, #1415, #1417, #1418, #1421-#1424, #1427, #1428, #1432, #1433, #1435-#1438, #1440-#1447, #1449-#1453, #1455-#1461, #1467, #1470, #1473-#1475, #1478-#1485, #1487-#1490, #1492, #1494-#1496), Lyda (#772), MarcWeber (#1078), neilwallace (#1390), offline-ant (#861, #862, #866, #868, #872, #874, #875, #877, #878, #880, #889, #890, #894, #897-#899, #904-#906, #910, #912, #928-#931, #933-#935, #946, #947, #951), Sabin Regmi (#823, #918, #919, #921, #923, #925, #936, #938-#941, #945, #957, #972, #974), tremolo (#920, #922), userRGH (#1491, #1546), wyenox (#817, #818, #989), ymote (#1223, #1343, #1345)
makepaddev
pushed a commit
that referenced
this pull request
Nov 26, 2026
27 files, +462 -175. Areas: widgets/families, draw/src, libs/makepad_test, libs/app_registry, widgets/core. Part 5 of 14 of work tip 67c2fe0d87 (with commercial 12ff43bfc0). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Co-Authored-By: Codex <267193182+codex@users.noreply.github.com> Co-Authored-By: amosarc <20733031+amosarc@users.noreply.github.com> Co-Authored-By: isaquepinheiro <4005289+isaquepinheiro@users.noreply.github.com> Co-Authored-By: wheregmis <26774729+wheregmis@users.noreply.github.com> Co-Authored-By: ymote <151983+ymote@users.noreply.github.com> Contributors: alanpoon (#770, #782, #788, #806, #1083, #1092, #1096), Alex (#757, #1048), amosarc (#1307), athxx (#1138), eddybruel (#733), Edward Tan (#1090), Guocork (#774), isaquepinheiro (#1556), jason-yau (#841, #1155, #1183, #1184, #1219), Julián Montes de Oca (#740, #764, #766, #775, #776, #794, #799, #802, #810, #821, #825, #833, #838, #839, #857, #860, #863, #867, #892), kevinaboos (#734-#737, #767, #780, #781, #783, #819, #831, #844, #881-#883, #887, #927, #937, #948, #950, #952, #956, #961, #970, #971, #973, #977, #980, #986, #990, #999-#1002, #1005-#1017, #1023, #1029, #1041, #1042, #1045, #1046, #1049, #1051-#1053, #1063, #1066-#1072, #1074, #1076, #1079, #1084, #1085, #1089, #1091, #1093, #1094, #1098, #1101, #1102, #1104, #1106, #1108-#1110, #1114, #1116, #1117, #1121, #1123, #1125, #1127, #1128, #1130, #1132, #1136, #1139, #1141, #1143, #1144, #1156, #1160, #1164, #1170, #1172, #1176, #1181, #1185, #1186, #1191, #1194, #1195, #1208-#1212, #1215, #1222, #1224, #1226, #1230-#1232, #1236, #1238, #1239, #1241, #1243, #1247, #1254-#1259, #1261, #1264, #1269, #1270, #1276, #1277, #1279, #1284, #1288, #1290-#1292, #1296-#1299, #1301, #1305, #1308, #1315-#1317, #1336, #1337, #1339, #1341, #1349, #1355, #1357-#1362, #1364-#1371, #1374, #1376, #1377, #1380, #1403, #1406-#1414, #1416, #1417, #1423, #1425-#1427, #1429, #1430, #1433, #1434, #1438, #1439, #1441, #1442, #1446-#1449, #1457, #1460-#1465, #1468-#1473, #1475-#1477, #1486, #1492, #1493), offline-ant (#861, #862, #869, #885, #897, #898, #901, #907, #908, #928-#930, #946, #947), Patrik Husfloen (#1142), poborin (#1032), Sabin Regmi (#884, #923, #938-#940, #942, #945, #972, #974, #978, #982), wyenox (#817, #818, #949)
makepaddev
added a commit
that referenced
this pull request
Nov 28, 2026
6 files, +95 -82. Areas: platform/hal, platform/src. Part 1 of 5 of work tip 46506c2592 (with commercial 2e04c58129). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Co-Authored-By: Codex <267193182+codex@users.noreply.github.com> Co-Authored-By: MarcWeber <34086+MarcWeber@users.noreply.github.com> Co-Authored-By: dotfrizzy <128760145+dotfrizzy@users.noreply.github.com> Co-Authored-By: kevinaboos <1139460+kevinaboos@users.noreply.github.com> Co-Authored-By: makepaddev <20386332+makepaddev@users.noreply.github.com> Co-Authored-By: moorbrook <619+moorbrook@users.noreply.github.com> Co-Authored-By: userRGH <49447120+userRGH@users.noreply.github.com> Co-Authored-By: wheregmis <26774729+wheregmis@users.noreply.github.com> Co-Authored-By: ymote <151983+ymote@users.noreply.github.com> Contributors: alanpoon (#770, #1083, #1096), athxx (#1138), CupOfOwls (#804), ddd-mtl (#1124), dotfrizzy (#786), Drin (#793), Edward Tan (#1090), Guocork (#742, #748), jason-yau (#841, #924, #926, #944, #953, #1148, #1155, #1168, #1169, #1183, #1184, #1219), Julián Montes de Oca (#764, #769, #790-#792, #798, #801, #803, #805, #807, #808, #811, #821, #833, #834, #836, #838, #839, #852, #857, #860, #863, #867), kevinaboos (#780, #819, #844, #846, #956, #977, #979, #987, #988, #990, #998, #1000, #1001, #1005, #1013, #1015, #1017, #1020, #1022, #1024, #1025, #1030, #1034-#1036, #1042, #1043, #1047, #1063, #1069, #1072, #1074-#1077, #1079, #1081, #1082, #1084-#1087, #1091, #1098, #1100, #1101, #1103, #1105-#1107, #1109, #1110, #1113, #1120, #1121, #1127, #1139, #1144, #1151, #1154, #1159, #1166, #1167, #1170, #1171, #1175, #1178, #1187, #1188, #1195-#1198, #1200, #1201, #1209, #1212, #1215, #1216, #1224, #1225, #1227, #1228, #1232, #1236, #1237, #1239, #1243-#1245, #1247, #1251, #1252, #1255, #1264, #1276, #1277, #1279, #1285, #1288, #1291, #1293, #1296, #1300, #1301, #1304, #1305, #1308, #1309, #1315, #1317, #1318, #1338, #1339, #1341, #1349, #1351, #1361-#1363, #1370-#1375, #1377, #1380, #1415, #1417, #1418, #1421-#1424, #1427, #1428, #1432, #1433, #1435-#1438, #1440-#1447, #1449-#1453, #1455-#1461, #1467, #1470, #1473-#1475, #1478-#1485, #1487-#1490, #1492, #1494-#1496), Lyda (#772), MarcWeber (#1078), neilwallace (#1390), offline-ant (#861, #862, #866, #868, #872, #874, #875, #877, #878, #880, #889, #890, #894, #897-#899, #904-#906, #910, #912, #928-#931, #933-#935, #946, #947, #951), Sabin Regmi (#823, #918, #919, #921, #923, #925, #936, #938-#941, #945, #957, #972, #974), tremolo (#920, #922), userRGH (#1491, #1546), wyenox (#817, #818, #989), ymote (#1223, #1343, #1345)
makepaddev
pushed a commit
that referenced
this pull request
Nov 28, 2026
1 files, +0 -6. Areas: widgets/core. Part 2 of 5 of work tip 46506c2592 (with commercial 2e04c58129). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Co-Authored-By: Codex <267193182+codex@users.noreply.github.com> Co-Authored-By: amosarc <20733031+amosarc@users.noreply.github.com> Co-Authored-By: isaquepinheiro <4005289+isaquepinheiro@users.noreply.github.com> Co-Authored-By: wheregmis <26774729+wheregmis@users.noreply.github.com> Co-Authored-By: ymote <151983+ymote@users.noreply.github.com> Contributors: alanpoon (#770, #782, #788, #806, #1083, #1092, #1096), Alex (#757, #1048), amosarc (#1307), athxx (#1138), eddybruel (#733), Edward Tan (#1090), Guocork (#774), isaquepinheiro (#1556), jason-yau (#841, #1155, #1183, #1184, #1219), Julián Montes de Oca (#740, #764, #766, #775, #776, #794, #799, #802, #810, #821, #825, #833, #838, #839, #857, #860, #863, #867, #892), kevinaboos (#734-#737, #767, #780, #781, #783, #819, #831, #844, #881-#883, #887, #927, #937, #948, #950, #952, #956, #961, #970, #971, #973, #977, #980, #986, #990, #999-#1002, #1005-#1017, #1023, #1029, #1041, #1042, #1045, #1046, #1049, #1051-#1053, #1063, #1066-#1072, #1074, #1076, #1079, #1084, #1085, #1089, #1091, #1093, #1094, #1098, #1101, #1102, #1104, #1106, #1108-#1110, #1114, #1116, #1117, #1121, #1123, #1125, #1127, #1128, #1130, #1132, #1136, #1139, #1141, #1143, #1144, #1156, #1160, #1164, #1170, #1172, #1176, #1181, #1185, #1186, #1191, #1194, #1195, #1208-#1212, #1215, #1222, #1224, #1226, #1230-#1232, #1236, #1238, #1239, #1241, #1243, #1247, #1254-#1259, #1261, #1264, #1269, #1270, #1276, #1277, #1279, #1284, #1288, #1290-#1292, #1296-#1299, #1301, #1305, #1308, #1315-#1317, #1336, #1337, #1339, #1341, #1349, #1355, #1357-#1362, #1364-#1371, #1374, #1376, #1377, #1380, #1403, #1406-#1414, #1416, #1417, #1423, #1425-#1427, #1429, #1430, #1433, #1434, #1438, #1439, #1441, #1442, #1446-#1449, #1457, #1460-#1465, #1468-#1473, #1475-#1477, #1486, #1492, #1493), offline-ant (#861, #862, #869, #885, #897, #898, #901, #907, #908, #928-#930, #946, #947), Patrik Husfloen (#1142), poborin (#1032), Sabin Regmi (#884, #923, #938-#940, #942, #945, #972, #974, #978, #982), wyenox (#817, #818, #949)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Animated GIF/WebP/APNG images didn't play correctly in an
Image, and everyImagedecoded its picture at full size, so a big photo drawn as a small thumbnail kept all of its pixels in memory (on both the CPU and the GPU). There's one commit for each.Animated images
size_in_pixelsreturned the size of the sprite sheet that holds an animation's frames, so anything sized by it (like an image viewer) stretched animations. It now returns one frame's size.ImageAnimation::Natural: each frame shows for its own delay, all animations step on one shared clock (so frames due together share a repaint), and an animation stops while it's off screen, e.g., in a hidden dock tab, until it's drawn again.post_process_imagedoesn't handle them), so APNGs now get their own compositor.is_animated_image()sniffs GIF/WebP/APNG headers.Imagethat missed its decode or its animation's clock tick catches up when it's drawn again, e.g., in aModal,DialogorFloatingPanel, which drop events while they're closed.Decoding at the drawn size
downscale_to_drawn_size: anImagewaits for its first draw, decodes its data halved like a mip level down to the size it's drawn at, and decodes it again only if it's later drawn bigger. Shrunk textures keep the image's natural size, so layout andsize_in_pixelsdon't change. A sliced image (ImageFit::Slice) always gets all of its pixels, since slices are cut in texels. Since it waits for a draw, it doesn't suit a picture that's only drawn once it has loaded, likeMedia's.image_size_by_datanow returns the size after EXIF orientation, matching what the decode produces for, e.g., portrait phone photos.Medialays pictures out with it, and director checks it against the decoded size.evict_image_from_cachealso releases the GPU copy when nothing else holds the texture, and keeps pixels that still need uploading.Testing
downscale_to_drawn_sizeon.