Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Slice up an image into tiles

Tags:

c#

.net

gdi+

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.

like image 945
AnthonyWJones Avatar asked Sep 16 '09 16:09

AnthonyWJones


People also ask

How do I split an image into Tile in Photoshop?

In Photoshop, use the Slice tool to split your image into tiles. First, select the Slice tool from the toolbar. Then, click and drag to create rectangular slices across your image. When you're finished, click the “Create” button in the options bar.


1 Answers

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

like image 155
Reed Copsey Avatar answered Oct 22 '22 03:10

Reed Copsey