0

When I drag a PNG file into Photoshop it comes in the indexed mode, and not in layer form.

Why does this happen and how can I solve it?

closed as unclear what you're asking by Ovaryraptor, Luciano, Mᴏɴᴋᴇʏ Mar 25 at 11:45

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • PNG files don't have layers, why did you expect something different? There's no problem to be solved. – Luciano Mar 22 at 13:05
  • @Luciano, he worded it pretty poorly but since he mentions indexed color mode, we can make the assumption that what he means by "layered mode" is that he is confused why in indexed color mode the single layer is locked and you can't add or remove layers or do much anything else. If a png file wasn't saved with indexed color and you open it in Photoshhop, the single layer in the document will not be locked and everything is editable. That's the only explanation that makes sense. He's not wondering why there's only one layer.... – Joonas Mar 22 at 15:37
  • @Joonas I know what you mean, but I don't know for sure that's what OP means. The original question mentions "it looks flatten" which I'm not sure Ovaryraptor should've removed on that edit. People ask the craziest of the things around here... – Luciano Mar 22 at 16:06
  • @Luciano , yea that's perhaps the worst word he could've used there. I was aware of him saying that. But think about how the layers panel acts when you open such an image file... Layers are basically disabled entirely and you got only one layer to work with. Describing it as "flattened", isn't that far fetched. Not flat in the sense that it opens with only one layer but flat in the sense that you can't add any. That's pretty flat in my book. – Joonas Mar 22 at 16:18
  • If there was no mention of indexed color, I'd totally be with you, Wolff and everyone who thought the question was him wondering why his png file only has one layer when it had more than one layer before saving... But since he did mention indexed color... I feel like it's maybe even less of a leap to assume it's that. – Joonas Mar 22 at 16:32
4

Sadly a PNG file can't have layers, so if you have saved your work as a PNG and closed the original document, the layers you had are lost.

1

You can just change the color mode to something different.

You'll likely want to do: Image > Mode > RGB color


Why do images sometimes open in indexed color mode?:

...and not other times?

  1. It's easy to accidentally save it with indexed color. When you export as png8 in PS, it's saved using indexed color.
  2. Image compression tools may decide to make it indexed color in order to get a smaller file size.
  3. And obviously, you can make the conscious decision to save it as such.

There's a pretty condensed description of indexed color in Adobe's Help Center site (helpx) about color modes:

Indexed Color mode produces 8‑bit image files with up to 256 colors. When converting to indexed color, Photoshop builds a color lookup table (CLUT), which stores and indexes the colors in the image. If a color in the original image does not appear in the table, the program chooses the closest one or uses dithering to simulate the color using available colors.

Although its palette of colors is limited, indexed color can reduce file size yet maintain the visual quality needed for multimedia presentations, web pages, and the like. Limited editing is available in this mode. For extensive editing, you should convert temporarily to RGB mode. Indexed color files can be saved in Photoshop, BMP, DICOM (Digital Imaging and Communications in Medicine), GIF, Photoshop EPS, Large Document Format (PSB), PCX, Photoshop PDF, Photoshop Raw, Photoshop 2.0, PICT, PNG, Targa®, or TIFF formats.


Automatic conversion from Indexed color to RGB color

For a period of time, I had to process many files, most of which were indexed color... So I made a script that converts Indexed to RGB.

If you just need to process one or a few images, you can probably apply the new color mode from the menu, but I decided to add the script because if I felt the need to write the script in the first place and I've been using it since... perhaps someone else will have use for it too...

If you set the variable silent as true, you don't get the alert that tells you the conversion happened. If you're doing like batch processing you definitely don't want to be clicking away 1 alert per image.

try {

  var silent = false; // No alert when Indexed Color mode is converted to RGB.

  var doc = app.activeDocument;
  var docPath = doc.path;
  var extension = doc.name.split('.').pop();
  var indexedColor = app.activeDocument.mode === DocumentMode.INDEXEDCOLOR;
  if ( indexedColor ) {
    doc.changeMode( ChangeMode.RGB );
    !silent && alert( 'Color mode changed: \n Indexed Color → RGB' );
  }

} catch(e) {}

The actual automatic conversion part

You can set the script to run every time a document is opened in: File > Scripts > Script Events Manager.... As a sort of reminder, the script will only do the conversion if the color mode is indexed. And the conversion can also be undone if needed.


To see your script in the script events manager's drop-down list, you gotta save that code snippet as Convert Indexed Color PNG to RGB.jsx and place it in this folder path: Adobe Photoshop CC 2019/Presets/Scripts/Event Scripts Only/.

For you the path may be slightly different, but if you find the folder where PS is installed... from there on the path should be Presets/Scripts/Event Scripts Only/.

  • Probably you could split your answer into 2. The first part is ok for normal users. The part 2 is a bit advanced for them. – Rafael Mar 20 at 20:52
  • @Rafael, you're not wrong about the second part being a bit advanced, but I feel it would be too disjointed as two separate answers because the second part doesn't really answer the question. It adds to the first part that takes care of the explanation. The structure is basically: 1. Here's how to solve the issue. 2. This is why it happens (more or less). 3. More info on Indexed color 4. Here's an automated method for solving the issue.. — Thinking of it this way, separating that into its own answer seems a bit pointless. Might as well split it into 4 different answers while I'm at it. – Joonas Mar 20 at 21:03

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