Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
249 views
in Technique[技术] by (71.8m points)

c# - Slice up an image into tiles

Given a loaded Bitmap object. I want to slice up this image into 256x256 tiles and save out each tile as a jpg file.

You may think this as a Silverlight Deep Zoom sort task and you'd be right.

I've got a solution using WPF but I would prefer a solution that would work in the .NET 2.0 framework. GDI+ is not somewhere I've spent any amount of time.

Anyone know how I could go about this? I can't seem to find a "Create Bitmap from a specified rectangle sort of method". I'd be surprised if one doesn't exist but perhaps I can't see the wood for the trees.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You can use Bitmap.Clone(Rectangle, PixelFormat) to crop out a 256x256 region of a source image. This works in .NET 2.0.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...