Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Image 如何在windows phone 8应用程序中调整图像大小?_Image_Windows Phone 8_Writeablebitmapex - Fatal编程技术网

Image 如何在windows phone 8应用程序中调整图像大小?

Image 如何在windows phone 8应用程序中调整图像大小?,image,windows-phone-8,writeablebitmapex,Image,Windows Phone 8,Writeablebitmapex,如何在windows phone 8.0应用程序中使用C#调整图像大小而不降低质量并显示完整图像 我所做的 我的XAML代码: 我的C代码 public主页() { 初始化组件(); //本地化ApplicationBar的示例代码 //BuildLocalizedApplicationBar(); BitmapImage=新的BitmapImage(); SetSource(Application.GetResourceStream(新Uri(@“Assets/Bug.jpg”,UriK

如何在windows phone 8.0应用程序中使用C#调整图像大小而不降低质量并显示完整图像

我所做的

我的XAML代码:



我的C代码

public主页()
{
初始化组件();
//本地化ApplicationBar的示例代码
//BuildLocalizedApplicationBar();
BitmapImage=新的BitmapImage();
SetSource(Application.GetResourceStream(新Uri(@“Assets/Bug.jpg”,UriKind.Relative)).Stream);
image.DecodePixelType=DecodePixelType.Logical;
image.CreateOptions=BitmapCreateOptions.BackgroundCreation;
image.CreateOptions=BitmapCreateOptions.DelayCreation;
图像img=新图像();
img.Source=图像;
WriteableBitmap wb=新的WriteableBitmap(图像);
调整大小(10001000,WriteableBitmapExtensions.Interpolation.Bilinear);
使用(MemoryStream stream=new MemoryStream())
{
SaveJpeg(流,1000,1000,0,100);
BitmapImage resize=新的BitmapImage();
resize.SetSource(流);
ImgPrev.Source=调整大小;
}
}

原始图像 图像的实际大小为38MB,尺寸为10240x6400,高度为10240,宽度为6400

我得到的结果如下图


其他图像是否也会出现同样的问题?是否要调整图像大小?你不能通过XAML调整它的大小吗?或者想动态调整它的大小?我认为这是455高度和Stretch=“无”的正确图像。尝试将拉伸更改为填充。我尝试将拉伸更改为填充。但不起作用。我想动态调整图像大小。