totiDev
totiDev

Reputation: 5275

Extract part of an image

There are a few images I am downloading to the phone and all of these images are 480x360 pixels. Now some of these do not use up the full 360 height, example they might only be 240 pixels in height (so the top and bottom are padded by 60 pixels in black). Does anyone have any suggestions how I can extract just the main part of the image, so that the new image would be 480x240?

Upvotes: 0

Views: 128

Answers (2)

Lee McPherson
Lee McPherson

Reputation: 931

Johan Falk's answer sounds like the best, but just to have an alternative, FJCore worked when I needed to do some image manipulation in Windows Phone. http://code.google.com/p/fjcore/

Upvotes: 0

Johan Falk
Johan Falk

Reputation: 4359

If you know which part of the image that is used you could simply crop the image using the WritableBitmapExtension library. Here is an example of how to crop an image:

WriteableBitmap wb = new WriteableBitmap(480, 360); // Load your image here instead
wb = wb.Crop(0, 0, wb.PixelWidth, 240); // Keep only the top part of the image (240 px)

Upvotes: 3

Related Questions