public static void CollectImages(Email email) { foreach (Attachment attachment in email.Attachments) { Picture picture = new Picture(); picture.Name = attachment.Name; picture.ImageData = Image.FromStream(attachment.Stream); OnPictureCollected(new PictureCollectedEventArgs() { picture = picture}); } }
public bool SavePicture(Picture image) { bool Success = true; try { image.ImageData.Save(TargetFolder + "\\" + image.Name, ImageFormat.Jpeg); } catch { Success = false; } return Success; }
static void PictureCollector_PictureCollected(PictureCollectedEventArgs e) { Image resized = PictureManipulator.ResizeTo800x600(e.picture.ImageData); Picture pict = new Picture() { ImageData = resized, Name = e.picture.Name }; saver.SavePicture(pict); }