public override bool Process(ImageWI iwi) { // what to do? switch (this.WorkingStyle) { case TASKWORKINGSTYLE.STRAIGHT: // destroy fib (will be reloaded by next task) iwi.CleanUp(); // save to temp file FileInfo tmpFI; if (iwi.ImageHandleWeak != null) { // when we hav a image handle save that to disk tmpFI = new FileInfo(Path.Combine(iwi.CurrentFile.DirectoryName ?? "./", DateTime.Now.Millisecond.ToString())); ImageWorker.SaveJPGImageHandle(iwi.ImageHandle, tmpFI); } else { // if we dont have a image handle use currentfileinfo tmpFI = iwi.CurrentFile; } // transform temp file ImageWorker.AutoRotateImageFI(tmpFI, this.nameExtension); // load into fib FIBITMAP?fibitmap = ImageWorker.GetJPGImageHandle(tmpFI); if (fibitmap != null) { iwi.ImageHandle = (FIBITMAP)fibitmap; } else { // tell anyone? } // remove tempfile tmpFI.Delete(); break; case TASKWORKINGSTYLE.COPYOUTPUT: // leave fib alone // save current version, if necessary if (iwi.ImageHandleWeak != null) { ImageWorker.SaveJPGImageHandle(iwi.ImageHandle, iwi.CurrentFile); } // transform current version to new name ImageWorker.AutoRotateImageFI(iwi.CurrentFile, this.nameExtension); break; case TASKWORKINGSTYLE.COPYINPUT: // destroy fib (will be reloaded by next task) // save current file // transform file to new name break; default: throw new ArgumentOutOfRangeException(); } ImageWorker.AutoRotateImageFI(iwi.CurrentFile, string.Empty); return(true); }
public void TestMetadata() { foreach (string s in Directory.GetFiles(@"..\..\..\testdata\pixrotate", "*")) { //FIBITMAP? dib = ImageWorker.GetJPGImageHandle(new FileInfo(s)); ImageWorker.AutoRotateImageFI(new FileInfo(s), "blabla"); //ImageWorker.CleanUpResources(dib); } }
private static void RotateTest() { ImageWorker.AutoRotateImageFI(new FileInfo(@"..\..\..\testdata\pixrotate\IMG_4222.jpg"), "_rot"); ushort u = ImageWorker.GetRotateInfo((FIBITMAP)ImageWorker.GetJPGImageHandle(new FileInfo(@"..\..\..\testdata\pixrotate\IMG_4222_rot.jpg"))); }