private static void MetaDataTest() { FileInfo fi = new FileInfo(@"..\..\..\testdata\pixrotate\IMG_4222.jpg"); FIBITMAP dib = (FIBITMAP)ImageWorker.GetJPGImageHandle(fi); ImageWorker.SaveJPGImageHandle(dib, fi.AugmentFileInfo("_meta")); }
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); }
private static void GetRotateInfo() { foreach (string s in Directory.GetFiles(@"..\..\..\testdata\pixrotate", "*")) { FileInfo fi = new FileInfo(s); FIBITMAP?dib = ImageWorker.GetJPGImageHandle(fi); if (dib != null) { ushort info = ImageWorker.GetRotateInfo((FIBITMAP)dib); } } }
private static void SetRotateInfo() { foreach (string s in Directory.GetFiles(@"..\..\..\testdata\pixrotate", "*")) { FileInfo fi = new FileInfo(s); FIBITMAP?dib = ImageWorker.GetJPGImageHandle(fi); if (dib != null) { ImageWorker.SetRotateInfo((FIBITMAP)dib, 8); ImageWorker.SaveJPGImageHandle((FIBITMAP)dib, new FileInfo(fi.AugmentFilename("_rotinfo"))); } } }
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"))); }