Black color disappears when I move to indexed

Hello, why sometimes when I pass an indexed color image the black disappears from the image ?.
How can i fix this?.

Hola, ¿por qué a veces cuando paso una imagen a color indexado el negro desaparece de la imagen?.
¿Cómo puedo solucionar esto?.

Include black in your palette.

When you go to Indexed, the image is converted to your current palette. If it lacks the colours necessary to reproduce the image, it’ll pick the closest ones.

If you want to use indexed mode with the image’s own colours rather than those in your current palette, then you will first need to create a palette from the image:

1 Like

But in my palette I have the color black.

1 - This does not happen if I only have one layer, that is, I can move to indexing and the black color does not disappear.

2 - This happens when I have two layers, 1 layer of background and another layer with the image, if I pass indexed here, the black color of my image disappears although in my palette it has the color black.

Pero en mi paleta tengo el color negro.

1 - Esto no sucede si sólo tengo una sola capa, es decir, puedo pasar a indexado y el color negro no desaparece.

2 - Esto sucede cuando tengo dos capas, 1 capa de background y otra capa con la imagen, si aquí paso a indexado, el color negro de mi imagen desaparece aunque en mi paleta tenga el color negro.

Do you have a color in your palette for “transparent”
One black swatch will be used as the color for transparent pixels in layers if you don’t use another color for transparency.

So in practice you need one swatch for transparent pixels, and another for opaque black. If you use the create palette from image command that eishiya showed, it should do this if your image has both opaque black areas and transparent pixels, but you can do it manually too if you want to have colors in your palette that you haven’t painted into the image yet.