using PixiEditor.Helpers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media.Imaging;
using System.Windows.Media;
namespace PixiEditorDotNetCore3.Models
{
public class Importer : NotifyableObject
{
///
/// Imports image from path and resizes it to given dimensions
///
/// Path of image.
/// New width of image.
/// New height of image.
///
public static WriteableBitmap ImportImage(string path, int width, int height)
{
Uri uri = new Uri(path);
BitmapImage bitmap = new BitmapImage();
bitmap.BeginInit();
bitmap.UriSource = uri;
bitmap.DecodePixelWidth = width;
bitmap.DecodePixelHeight = height;
bitmap.EndInit();
return new WriteableBitmap(bitmap);
}
}
}