# Palette altered when loading/saving in .gif format

**URL:** <https://community.aseprite.org/t/palette-altered-when-loading-saving-in-gif-format/4427>\
**Category:** Bug Reports\
**Created:** [December 15, 2019, 4:13pm UTC](https://community.aseprite.org/t/palette-altered-when-loading-saving-in-gif-format/4427 "2019-12-15T16:13:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JJHaggar](https://community.aseprite.org/user_avatar/community.aseprite.org/jjhaggar/32/266_2.png) [@JJHaggar](https://community.aseprite.org/u/JJHaggar)\
**Post date:** [December 15, 2019, 4:13pm UTC](https://community.aseprite.org/t/palette-altered-when-loading-saving-in-gif-format/4427/1 "2019-12-15T16:13:18Z")

</div>

Hello,

When I’m working on my sprites I use Aseprite for making animations, and other software for some other tasks.

Recently I’ve been working in a project that requires [palette swapping](https://en.wikipedia.org/wiki/Palette_swap), so I am working with indexed colors and carefully organizing the palette in color groups for different parts of the sprite in Photoshop.

 ![imagen](https://community.aseprite.org/uploads/default/original/2X/6/6c2f5057265bc34ab7c10720c757a7b631fb8d10.png)

For convenience at work with my team I’m using gif files. The problem is that when I open with Aseprite a gif file created by Photoshop, Aseprite doesn’t detect its color mode as indexed by default (!)

![imagen](https://community.aseprite.org/uploads/default/original/2X/f/feb18fc59a0afd86ab689713396c4576e4aca959.png)

And on top of that, when I save the file Aseprite alters its palette. I think it kind of shrinks the original palette, altering the index order of the colors, which is of vital importance to me ☹

 ![imagen](https://community.aseprite.org/uploads/default/original/2X/d/db12c8ecf2c3a34c1fea94c49dc918157a66489e.png)

After that, if I open the file in Photoshop I can confirm that the palette is broken ☹

![imagen](https://community.aseprite.org/uploads/default/original/2X/1/1cfaaf1ab59dfb1f8606f09715b0d41b71e752fc.png)

You can find here the original file and the same file after being opened and saved again with Aseprite: [https://drive.google.com/drive/u/0/folders/1Wt724TaIpRd-FyiM0meiqimeFXXv55Ez](https://drive.google.com/drive/u/0/folders/1Wt724TaIpRd-FyiM0meiqimeFXXv55Ez)

I’m using Aseprite v1.2.16.3-x64 downloaded from Steam (and I’m on Windows 7 ultimate 64 bits).

Is there maybe a workaround for this? I’m kind of stuck I fear ^^U

P.S: I think this bug post also may be somewhat related to this feature request: [Group Swatches Within Palette](https://community.aseprite.org/t/group-swatches-within-palette/372)

---

<div class="post-metadata">

**Author:** ![eishiya](https://community.aseprite.org/user_avatar/community.aseprite.org/eishiya/32/902_2.png) [@eishiya](https://community.aseprite.org/u/eishiya)\
**Post date:** [December 15, 2019, 5:42pm UTC](https://community.aseprite.org/t/palette-altered-when-loading-saving-in-gif-format/4427/2 "2019-12-15T17:42:45Z")

</div>

This is unrelated to the grouping feature request, which is purely cosmetic palette organization.

The “bug” here is that Aseprite optimizes the palette, removing redundant and unused colours. This is a useful feature in most cases, but it works against your workflow.  
Unfortunately, palette organization is not standard, different programs save them differently, some with more or less optimization. Even Photoshop can eat up your palette if you’re not careful.

If your palette swapping code would allow it, I recommend including the palette as part of your spritesheet, and building the indexes for your palette swaps based on that rather than relying on a specific colour order in the files, since that’s unreliable. As a bonus, this should reduce your file sizes a little since you’d be dealing with fewer palette entries (the palette pixels would likely take up less space than the extra palette data).

---

<div class="post-metadata">

**Author:** ![JJHaggar](https://community.aseprite.org/user_avatar/community.aseprite.org/jjhaggar/32/266_2.png) [@JJHaggar](https://community.aseprite.org/u/JJHaggar)\
**Post date:** [December 15, 2019, 7:30pm UTC](https://community.aseprite.org/t/palette-altered-when-loading-saving-in-gif-format/4427/3 "2019-12-15T19:30:30Z")

</div>

Hi, thanks for the answer! 🙂

The palette swapping code that we use already uses sprites as palettes (each different palette is a sprite of 256x1 pixel size), but that’s not really the issue for me. The problem is that if Aseprite alters palettes, I cannot use it side by side with other programs such as Photoshop and Gimp, which I need to use for automating tasks (they save me lots of time).

> [@eishiya](#):
>
> The “bug” here is that Aseprite optimizes the palette, removing redundant and unused colours

Yes, I think that’s the problem. If one could choose between optimicing palette or not (checking a box for example), that would be great ^^
