imagesharp exif
This commit is contained in:
parent
6bb403e986
commit
bf760b6da4
3 changed files with 59 additions and 6 deletions
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
|
@ -8,6 +9,6 @@ namespace CatalogLib
|
|||
{
|
||||
public interface IImageProcessor
|
||||
{
|
||||
|
||||
void Start(FileInfo workFile);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,11 +14,61 @@ namespace CatalogLib
|
|||
{
|
||||
public void Start(FileInfo workFile)
|
||||
{
|
||||
using (Image image = new Image(workFile.Name))
|
||||
using (Image image = new Image(workFile.FullName))
|
||||
{
|
||||
JpegDecoder j = new JpegDecoder();
|
||||
|
||||
image.Resize(200, 200).Save("");
|
||||
if (PicSettings.Instance.UsaRotazioneAutomatica)
|
||||
{
|
||||
|
||||
|
||||
var exif = image.MetaData.ExifProfile;
|
||||
if (exif != null)
|
||||
{
|
||||
var o = exif.GetValue(ExifTag.Orientation);
|
||||
if (o != null)
|
||||
{
|
||||
int v = (int) o.Value;
|
||||
switch (v)
|
||||
{
|
||||
|
||||
|
||||
//1 = Horizontal(normal)
|
||||
//2 = Mirror horizontal
|
||||
//3 = Rotate 180
|
||||
//4 = Mirror vertical
|
||||
//5 = Mirror horizontal and rotate 270 CW
|
||||
//6 = Rotate 90 CW
|
||||
//7 = Mirror horizontal and rotate 90 CW
|
||||
//8 = Rotate 270 CW
|
||||
case 1:
|
||||
break;
|
||||
case 2:
|
||||
break;
|
||||
case 3:
|
||||
image.Rotate(180);
|
||||
break;
|
||||
case 4:
|
||||
break;
|
||||
case 5:
|
||||
break;
|
||||
case 6:
|
||||
image.Rotate(90);
|
||||
break;
|
||||
case 7:
|
||||
break;
|
||||
case 8:
|
||||
image.Rotate(-90);
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//JpegDecoder j = new JpegDecoder();
|
||||
image.Save(Path.Combine(PicSettings.Instance.DirectoryDestinazione,workFile.Name));
|
||||
//image.Resize(200, 200).Save("");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,7 +61,9 @@ namespace WPFCatalog
|
|||
|
||||
foreach (var file in Directory.EnumerateFiles(PicSettings.DirectorySorgente))
|
||||
{
|
||||
ImageCreator2 i = new ImageCreator2();
|
||||
IImageProcessor i = new ImgSharpCreator();
|
||||
|
||||
//ImageCreator2 i = new ImageCreator2();
|
||||
i.Start(new FileInfo(file));
|
||||
}
|
||||
DialogHelper.PopUpAlert("Finished", "message");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue