imagesharp exif
This commit is contained in:
parent
6bb403e986
commit
bf760b6da4
3 changed files with 59 additions and 6 deletions
|
|
@ -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("");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue