mgnsa.blogg.se

Print a jpg out at a to be specific width in windows 10
Print a jpg out at a to be specific width in windows 10




Background Tasks are even more limited than just regular WinRT projects, because they must be of type Windows Runtime Component. The goal here was to find out, how to manipulate images in WinRT, specifically in Background Tasks. So here is my solution I came with after lot of googling and trial/error coding: Img.Source = bImg // image element in xaml convert the entire bitmap to a 100px by 100px bitmapīitmapBounds bounds = new BitmapBounds() InMemoryRandomAccessStream ras = new InMemoryRandomAccessStream() īitmapEncoder enc = await BitmapEncoder.CreateForTranscodingAsync(ras, decoder) create a new stream and encoder for the new image

print a jpg out at a to be specific width in windows 10

Var fileStream = await file.OpenAsync() īitmapDecoder decoder = await BitmapDecoder.CreateAsync(fileStream) create a stream from the file and decode the image StorageFile file = await StorageFile.GetFileFromPathAsync(filePath)

print a jpg out at a to be specific width in windows 10 print a jpg out at a to be specific width in windows 10

String filePath = "C:\\Users\\Public\\Pictures\\Sample Pictures\\fantasy-dragons-wallpaper.jpg" Example of how to scale and crop taken from here: async private void BitmapTransformTest()






Print a jpg out at a to be specific width in windows 10