C# Bitmap.Save 将图像保存到其他位置作为路径
我正在做一个简单的图像调整大小,最后我想将其保存为:
path = "C:\\new_image.jpg";
img.Save(path, jpegCodec, encoderParams);
问题是它保存到 "....... \Users\Ervin\AppData\Local\VirtualStore\" 。 我做错了什么或者我错过了什么?
更新:我更改了其他文件夹的路径,并且它有效。看来我只能保存到 C:\ 。
I'm doing a simple image resize and on the final I want to save it like:
path = "C:\\new_image.jpg";
img.Save(path, jpegCodec, encoderParams);
The problem is it saves to "....... \Users\Ervin\AppData\Local\VirtualStore\" .
What did I do wrong or what did I miss out?
UPDATE: I changed the path to an other folder, and it works. it seems I can't save to C:\ only.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
对此的解决方案是您正在运行的用户,因为没有直接写入 C: 驱动器的写入权限,这对 Win7 或 Vista 来说是新的,我不确定是哪一个。
您可以通过以下方法解决此问题:
添加 \Users\Ervin\AppData\Local\VirtualStore\ 是为了在更新时帮助修复旧版应用程序。您可能还注意到虚拟商店的“程序文件”中有很多条目。这些程序试图写入程序文件中自己的目录,而不是像它们应该的那样写入 %LOCALAPPDATA% 。
The resion for this is the user you are running as does not have write permissions to write directly to the C: drive this was new to either Win7 or Vista I am not shure which.
You can solve this by:
....... \Users\Ervin\AppData\Local\VirtualStore\ was added to help fix legacy applications when you updated. You may also notice a lot of entries in the "Program Files" in the virtual store. these are programs trying to write to their own directory in program files instead of %LOCALAPPDATA% like they should.
这是在 Vista 中引入的,称为虚拟化:
This was introduced in Vista, called Virtualization: