Commit 8d240f762 for imagemagick.org

commit 8d240f762f2a8def6be330675c603a970e74bb09
Author: Naveed Khan <164054284+rootvector2@users.noreply.github.com>
Date:   Sun Nov 8 23:41:43 2026 +0530

    map indexed pixels to colormap colors in ReadASEImage (#9105)

    The 8-bit frame loop only set the pixel index, leaving the red, green,
    blue and alpha samples of indexed sprites as uninitialized pixel cache
    memory.

diff --git a/coders/ase.c b/coders/ase.c
index 8c37a2b4c..86e404b51 100644
--- a/coders/ase.c
+++ b/coders/ase.c
@@ -1177,6 +1177,7 @@ static Image *ReadASEImage(const ImageInfo *image_info,ExceptionInfo *exception)
             if (index >= (ssize_t) frame_image->colors)
               index=0;
             SetPixelIndex(frame_image,(Quantum) index,q);
+            SetPixelViaPixelInfo(frame_image,frame_image->colormap+index,q);
             p++;
             q+=GetPixelChannels(frame_image);
           }
diff --git a/tests/cli-pipe.tap b/tests/cli-pipe.tap
index 906f0f059..bfc62fe20 100755
--- a/tests/cli-pipe.tap
+++ b/tests/cli-pipe.tap
@@ -18,7 +18,7 @@
 #
 . ./common.shi
 . ${srcdir}/tests/common.shi
-echo "1..27"
+echo "1..28"

 ${MAGICK} pnm:- null:   < ${SRCDIR}/rose.pnm && echo "ok" || echo "not ok"
 ${MAGICK} pnm:- info:   < ${SRCDIR}/rose.pnm && echo "ok" || echo "not ok"
@@ -170,4 +170,21 @@ if [ "X$sample" = 'Xffffffffffffffff' ]; then
 else
   echo "not ok 27 - 64-bit raw export of a full-range sample: $sample"
 fi
+
+# An indexed Aseprite cel must decode to its palette colors.
+colors=`{ printf '\000\000\000\000\245\340\001\000\002\000\001\000\010\000'
+  dd if=/dev/zero bs=114 count=1 2>/dev/null
+  printf '\000\000\000\000\372\361\002\000\000\000\000\000\000\000\000\000'
+  printf '\054\000\000\000\031\040\003\000\000\000\000\000\000\000\002\000'
+  printf '\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\377'
+  printf '\000\000\377\000\000\377\000\000\000\000\377\377'
+  printf '\034\000\000\000\005\040\000\000\000\000\000\000\377\000\000\000'
+  printf '\000\000\000\000\000\000\002\000\001\000\001\002'; } |
+  LC_ALL=C ${MAGICK} ASE:- -format '%[pixel:p{0,0}]|%[pixel:p{1,0}]' \
+    info:- 2>/dev/null`
+if [ "X$colors" = 'Xsrgba(255,0,0,1)|srgba(0,0,255,1)' ]; then
+  echo "ok 28 - indexed ASE cel decodes to palette colors"
+else
+  echo "not ok 28 - indexed ASE cel decodes to palette colors: $colors"
+fi
 :