Sunday, 15 January 2012

c# - Resizing and cropping images using ImageResizer -



c# - Resizing and cropping images using ImageResizer -

i'm trying resize , square-crop incoming images. have image in readonlystream , output memorystream.

i'm using imageresizer library this.

i'd images first cut down in size , center-square-crop them. i'm using code, doesn't produce require. produces nothing...

var resultstream = new memorystream(); imagejob job = new imagejob(imagestream, resultstream, new instructions { width = 100, height = 100, mode = fitmode.crop }); job.build();

this code should downsample big images , crop them based on library defaults (center cropping).

i didn't provide specific configuration in web.config because understand things it's not required.

what doing wrong?

imageresizer not reset output stream position 0 after writing it, break non-seekable write streams httpresponsestream.

you need phone call resultstream.seek(0, seekorigin.begin); before reading it.

c# imageresizer resize-crop

No comments:

Post a Comment