<commit_before>﻿using kh.kh2;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using Xe.Tools;
using Xe.Tools.Wpf;

namespace kh.tools.imgz.Models
{
	public class ImageModel : BaseNotifyPropertyChanged
	{
		private Imgd imgd;

		public ImageModel(Imgd imgd)
		{
			Imgd = imgd;
		}

		public Imgd Imgd
		{
			get => imgd;
			set => LoadImgd(imgd = value);
		}

		public BitmapSource Image { get; set; }

		public string DisplayName => $"{Image.PixelWidth}x{Image.PixelHeight}";

		private void LoadImgd(Imgd imgd)
		{
			LoadImage(imgd.GetBitmap(), imgd.Size.Width, imgd.Size.Height);
		}

		private void LoadImage(byte[] data, int width, int height)
		{
			Image = BitmapSource.Create(width, height, 96.0, 96.0, PixelFormats.Bgra32, null, data, width * 4);
			OnPropertyChanged(nameof(Image));
		}
	}
}<commit_msg>Fix compilation error on kh.tools.imgz <commit_after>﻿using kh.Imaging;
using kh.kh2;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using Xe.Tools;
using Xe.Tools.Wpf;

namespace kh.tools.imgz.Models
{
	public class ImageModel : BaseNotifyPropertyChanged
	{
		private Imgd imgd;

		public ImageModel(Imgd imgd)
		{
			Imgd = imgd;
		}

		public Imgd Imgd
		{
			get => imgd;
			set => LoadImgd(imgd = value);
		}

		public BitmapSource Image { get; set; }

		public string DisplayName => $"{Image.PixelWidth}x{Image.PixelHeight}";

        private void LoadImgd(Imgd imgd)
        {
            LoadImage(imgd);
        }

        private void LoadImage(IImageRead imageRead)
        {
            var size = imageRead.Size;
            var data = imageRead.ToBgra32();
            Image = BitmapSource.Create(size.Width, size.Height, 96.0, 96.0, PixelFormats.Bgra32, null, data, size.Width * 4);
            OnPropertyChanged(nameof(Image));
        }
	}
}
{'fraction_non_alphanumeric': 0.11745152354570637, 'fraction_numerical': 0.01218836565096953, 'mean_word_length': 3.1232876712328768, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6593688', 'n_tokens_mistral': 702, 'n_tokens_neox': 620, 'n_words': 141}