Why does the image look like that, with so many black squares?

Hello, I have just joined the forum.
I am a game developer and, for a game I am making, I created an image. I converted the word file to jpg, scaled the image to 320 x 244 pixels and converted it to gif. That image in the game has many black squares.
I would like to know why they come out and how I can remove them.
Thank you in advance.

This is the image that you see out of the game.

This is the image that you see in the game.
bor.pak - 0000

Ciao Stefano, and welcome!

More information needed.
Operating system?
What “word” program did you use?
How did you convert the word file to jpg? In what program?
How did you scale the image? In what program?
How did you convert it to a gif? In what program?

Have fun!
Claes in Lund, Sweden

That GIF file contains two identical images, which seems a bit strange.

I can’t see anything in either image that would cause black pixels. The minimum value in the green channel is 174 out of 255.

I suspect a bug, or something weird, in your game program. For example, perhaps it can only display a small number of colours or limited palette at any one time.

The black pixels seem to always correspond to pixels that are color (0,174,78) in the GIF. And as a coincidence, (0,174,78) is the first color in the color map, which is often the one used to mark the “transparent” color.

So perhaps you need to make sure that there is a transparent color (even in unused).

The mysteries to me:

  • Why two identical frames in the GIF
  • Why is the green background not uniform?
  • Why is you GIF 320x244px and the PNG 320x240px?

I’ll add another comment.

JPG is usually lossy, which means that pixel colours will change, especially where there are sudden changes in colour. For the best quality result, with a constant green background, don’t go via JPG compression.

As a rule of thumb: JPG is a useful final format for photographs, after doing any required processing, and should not be used for anything else.

The random looking dots remind me of artifacts.
Did you use a color profile when generating the gif? The black dots might be used to replace a color that was out of gamut for the color space.

Operating system: Windows 10
To write the text I used Microsoft Word 2010.
I converted the word file to jpg on the site https://convertio.co/it/doc-jpg/.
I scaled the image by Gimp.
I converted the jpg file to a gif on the site https://www.iloveimg.com/it/jpg-in-immagine/jpg-in-gif. To create a gif image, that lasts 10 seconds in the game before moving to another screen, I had to put also a copy of the jpg file otherwise with only image you can not create it.

That gif file contains two identical images because I wanted to create a gif image that lasts 10 seconds in the game before moving to another screen. And in the site where I created it, to make the image with this duration, I had to add a copy of the image otherwise you can not create it. https://www.iloveimg.com/it/jpg-in-immagine/jpg-in-gif

  1. To create a gif image that lasts 10 seconds in the game before moving to another screen, in the site I had to put also a copy of the jpg file otherwise with only image you can not create it.
  2. I don’t know why the green background is not uniform.
  3. The game has the resolution 320 x 240 and within it you can create a screenshot pressing a button. The screenshot has the same resolution of the game and it is in png. The gif image has the resolution 320 x 244 pixel because, when I started to learn the engine with which I am developing the game, I saw that most of images are 320 x 244 pixel.

So what can I do?

To write the text with green background I used Microsoft Word 2010 and I converted the word file to jpg. I did not use a color profile when generating the gif.

… when you can do all of this in Gimp alone? I assume you are asking the same question in forums for all other involved apps/sites then?

1 Like

Try this:

  • Load the GIF, convert to Full RGB
  • File > Open as layers the PNG screenhsot (which should keep its black spots if you converted the GIF to RGB)
  • Align the layers (a good way is to set the top layer to Difference mode and move the layer to have mostly black)
  • Remove the Difference mode
  • Color-select the black pixels
  • Hide the screenshot layer, select a GIF layer
  • Start the Histogram (Windows > Dockable dialog > Histogram)


All the black pixels in the screenshot have the very same R/G/B values in the GIF. If these were JPG artifacts they would be random, and likely would be loosely grouped in 8x8 squares.

You could have done all of that directly in Gimp. And it would save you the JPEG step, since you can export directly to GIF.

That sounds odd. Can’t you just tell the game engine to show a static image for 10 seconds? I suspect the issue is that you tried to use an animated GIF, when a static GIF would have been better.

In the original JPEG, they probably didn’t have the exact same value. But likely they were close enough that they got converted to the same value in the GIF. And the way they are clustered around the text suggests that they are indeed compression artifacts.

I would use a workflow that doesn’t involve intermediate JPG files.

For example, I would create a document in OpenOffice Writer. (This is free, and downloadable.) Export that as a PDF file named sampleText.pdf.

Then I would use ImageMagick to rasterize the PDF file. (This also needs Ghostscript.) This command also trims the image, adds a white border, and duplicates it to give two images in the GIF.

magick -density 144 sampleText.pdf -layers Flatten -trim +repage -bordercolor White -border 50 -duplicate 1 out.gif


@snibgo I would write directly in GIMP, no LibreOffice, no pdf, no jpg, no artefacts, no terminal for imagemagick, etc…
It’s just a green BG with some writing on it.
As a matter of fact ALL what did the OP, should have taken less than a minute or two in GIMP, exported as animated gif with just 2 frames from GIMP included.

Yes, that’s fine. I don’t know Gimp that well. If the entire job can be done in Gimp, that is an obvious workflow.

Considering the OP’s lack of technical expertise, suggestions as complex as yours aren’t very useful. Or you’ll need to be much more verbose in your explanation.

Everything, including animation, can be done in Gimp.

Yes :slight_smile: