Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to edit and save photo in Windows Store App?
    primarykey
    data
    text
    <p>I make some application which edit photo and save it in other location. So I find a <a href="https://stackoverflow.com/questions/12349611/how-to-resize-image-in-c-sharp-winrt-winmd">question</a> which shows how to resize photos in Windows Store Apps. Then I implement it in my program:</p> <pre><code>private async void ResizeButton_Click(object sender, RoutedEventArgs e) { uint width, height; if (uint.TryParse(WidthTextBox.Text, out width) &amp;&amp; uint.TryParse(HeightTextBox.Text, out height) &amp;&amp; _folderWithPhoto != null &amp;&amp; _targetFolder != null) //_folderWithPhoto and _targetFolder are StorageFolder values get from FolderPicker { var files = await _folderWithPhoto.GetFilesAsync(); foreach (StorageFile item in files) { if (item.ContentType.Contains("image")) { StorageFile targetFile = await item.CopyAsync(_targetFolder, item.Name, NameCollisionOption.GenerateUniqueName); var fileStream = await targetFile.OpenAsync(Windows.Storage.FileAccessMode.ReadWrite); BitmapDecoder decoder = await BitmapDecoder.CreateAsync(fileStream); InMemoryRandomAccessStream ras = new InMemoryRandomAccessStream(); BitmapEncoder enc = await BitmapEncoder.CreateForTranscodingAsync(ras, decoder); enc.BitmapTransform.ScaledHeight = height; enc.BitmapTransform.ScaledWidth = width; await enc.FlushAsync(); } } } } </code></pre> <p><strong>Problem</strong></p> <p>Result of this code is the same photo saved in <code>_targetFolder</code> catalogue. So I have no idea how to fix it.</p> <p>Any help would be appreciated.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload