0
Personal I am developing an app in WPF and at a certain point I need to convert the DPI of an image, as I do?
I’m using the class System.Windows.Media.Imaging.BitmapImage
And to load the image I use the following code:
var fileUri = new Uri(openDlg.FileName); var bitmap = new BitmapImage(); bitmap.BeginInit(); bitmap.CacheOption = BitmapCacheOption.None; bitmap.UriSource = fileUri; bitmap.EndInit();
One option would be to make the resize calculation that way:
double resizeFactor = 96 / currentDpi; int width = Convert.ToInt32(bitmap.PixelWidth * resizeFactor); int height = Convert.ToInt32(bitmap.PixelHeight * resizeFactor);
It works, but it’s not working =/
If you know a library tbm help :D
What’s the problem after all? You don’t know how to use
width
andheight
to change the IPR?– Genos
In the end I have images in 3 resolutions (DPI), 72, 96 and 120... I need to turn them all to 96, regardless if I increase the width and height
– picossi
It worked, I used the framework Emgu CV, as I would already use it to make equalization of the histogram ended up using the resize of it
– picossi