|
1 | 1 | using System;
|
2 | 2 | using System.Collections.Concurrent;
|
3 | 3 | using System.Collections.Generic;
|
| 4 | +using System.Diagnostics; |
4 | 5 | using System.IO;
|
5 | 6 | using System.Linq;
|
6 | 7 | using System.Net;
|
@@ -288,9 +289,33 @@ private static BitmapImage LoadFullImage(string path)
|
288 | 289 | BitmapImage image = new BitmapImage();
|
289 | 290 | image.BeginInit();
|
290 | 291 | image.CacheOption = BitmapCacheOption.OnLoad;
|
291 |
| - image.UriSource = new Uri(path); |
| 292 | + image.UriSource = new Uri(path); |
292 | 293 | image.CreateOptions = BitmapCreateOptions.IgnoreColorProfile;
|
293 | 294 | image.EndInit();
|
| 295 | + |
| 296 | + if (image.PixelWidth > 320) |
| 297 | + { |
| 298 | + BitmapImage resizedWidth = new BitmapImage(); |
| 299 | + resizedWidth.BeginInit(); |
| 300 | + resizedWidth.CacheOption = BitmapCacheOption.OnLoad; |
| 301 | + resizedWidth.UriSource = new Uri(path); |
| 302 | + resizedWidth.CreateOptions = BitmapCreateOptions.IgnoreColorProfile; |
| 303 | + resizedWidth.DecodePixelWidth = 320; |
| 304 | + resizedWidth.EndInit(); |
| 305 | + |
| 306 | + if (resizedWidth.PixelHeight > 320) |
| 307 | + { |
| 308 | + BitmapImage resizedHeight = new BitmapImage(); |
| 309 | + resizedHeight.BeginInit(); |
| 310 | + resizedHeight.CacheOption = BitmapCacheOption.OnLoad; |
| 311 | + resizedHeight.UriSource = new Uri(path); |
| 312 | + resizedHeight.CreateOptions = BitmapCreateOptions.IgnoreColorProfile; |
| 313 | + resizedHeight.DecodePixelHeight = 320; |
| 314 | + resizedHeight.EndInit(); |
| 315 | + return resizedHeight; |
| 316 | + } |
| 317 | + return resizedWidth; |
| 318 | + } |
294 | 319 | return image;
|
295 | 320 | }
|
296 | 321 | }
|
|
0 commit comments