5

When opening some .PNG files created in R, using GIMP, and via 'Open as Layers', the color of the images changes. Some turn yellow, some black, one even a gets a reddish tint. When I open them separatly, the problem doesn't occur, but I would like to merge them into one figure, hence I try to open them with 'Open as Layers'. This worked for me in the past, but with these .PNG's, something goes wrong.

All of the files should have the same resolution, extention, were created the same way, etc...

Below you can find a screenshot of gimp, and the layers, they should all show up white, but some get colored, alas:

enter image description here

Update

I can get the different PNG together if i open them separatly, and then copy and paste them into the first opened PNG window. This will keep the original color. However, this takes some time, and would still like to learn how to avoid the color change when bulk importing them all at once.

update2

I found a solution: Instead op opening gimp, and directly importing the images, I now created a new document first, using File > New, and selected a standard template. When I now import all the images using File > Open as Layers, the PNG's show up as exported via R, not colored like in the above example.

2 Answers 2

8

The PNGs are color-indexed (the title bar states this in your screenshot), in which case imported images are coerced into the color map of the first image. Use Image>Mode>RGB on the first image before importing the others.

In your workaround, you start with a new image which by default is already in RGB mode.

3
  • Thanks for pointing out the color-indexation in the title bar, I'll keep an eye on it in the future!
    – MaartenVL
    Mar 10, 2017 at 8:54
  • Thank you so much. Any idea how to reverse that image mode change after the image has been opened?
    – Joe Eifert
    Jun 8, 2018 at 11:25
  • After you imported the layers? No way. The information is lost. You have ot got full RGB, then re-import.
    – xenoid
    Jun 8, 2018 at 11:48
0

I found a solution: Instead op opening gimp, and directly importing the images, I now created a new document first, using File > New, and selected a standard template. When I now import all the images using File > Open as Layers, the PNG's show up as exported via R, not colored like in the above example.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.