开发者

C# Shell Thumbnails - How to add a crop-starting position

开发者 https://www.devze.com 2023-02-06 21:07 出处:网络
Searching for a way to extract Shell Thumbnails for a windows application, I ran into this post and its very useful answer by AMissico:

Searching for a way to extract Shell Thumbnails for a windows application, I ran into this post and its very useful answer by AMissico: C# get thumbnail from file via windows api The sample project that solves the problem posted above can be downloaded here: http://cid-7178d2c79ba0a7e3.office.live.com/self.aspx/.Public/ShellThumbnail.zip (I hope the original poster won't mind ...)

I've been able to modify the code posted by AMissico to keep the original aspect ratio of the images, but what I would like to do is offer a crop option, and mention the top-left point to start cropping from.

The sample project posted by AMissico uses the IExtractImage interface, with methods GetLocation and Extract. The GetLocation method accepts a size parameter, but I haven't found any way to add a starting point for the cropped image to it.

I wo开发者_开发知识库uld appreciate any help in doing this. Thanks!


I don't think there is a built-in way to obtain the thumbnail cropped. The size parameter is used for obtaining an image of a certain size (which can be the thumbnail image resized to that certain size or a completely different image for some ranges of the size parameter).

However, in the end, after obtaining the thumbnail image, why not crop that image right after obtaining and before first using it?

0

精彩评论

暂无评论...
验证码 换一张
取 消