private void BuildChannelsPanel() { var layer = project.selectedLayer; channels.Items.Clear(); using var image = (MagickImage)layer.FilteredImage.Clone(); var layerChannels = image.Separate(Channels.Red | Channels.Green | Channels.Blue | Channels.Alpha); channels.Items.Add(GUILayout.Header("RGB")); channels.Items.Add(new Image { Source = image.ToBitmapImage(false) }); var i = 0; foreach (MagickImage channel in layerChannels) { var imageChannel = new Image { Source = channel.ToBitmapImage() }; var txt = ""; switch (i) { case 0: txt = "Red"; break; case 1: txt = "Green"; break; case 2: txt = "Blue"; break; case 3: txt = "Alpha"; break; } if (txt.Length > 0) { channels.Items.Add(GUILayout.Header(txt)); } channels.Items.Add(imageChannel); i++; } }