Rank: Advanced Member
Groups: Member
Joined: 9/6/2005(UTC) Posts: 106
|
This is my final problem and I will leave you guys alone. I really need tiff tag support to get the orientation. We have been doing debug and testing on the project prior to distribution in the field. I have left a few of our big customers look at our new product and they all have said the same thing, why are half the images upside down. I will forego the bitmapstate if we can fix the tiff tag support. I trying to be difficult I just need some options that I am sure are in your other products. It would be hard to have a winform control in these days that did not get the orientation correct. I appreciate you help so far and hope that I you will be able to add tiff tag support.
Thanks
Chris
|
|
|
|
Rank: Advanced Member
Groups: Member, Administration, Moderator Joined: 8/3/2003(UTC) Posts: 1,070
Thanks: 1 times Was thanked: 12 time(s) in 12 post(s)
|
Hello Chris, Graphics Mill for .NET doesn't support arbitrary TIFF tags, but it supports EXIF and IPTC meta information. Support of arbitrary tags will be implemented in future versions of the library. Orientation TIFF tag is included to EXIF meta information. So you can obtain the value via EXIF dictionary collection. See the following code snippet: Code:System.UInt32 orientation = 1;
Aurigma.GraphicsMill.Codecs.TiffReader reader = new Aurigma.GraphicsMill.Codecs.TiffReader(@"d:/images/test/pict0027.tif");
if(reader.Exif != null)
orientation = (System.UInt32)reader.Exif[Aurigma.GraphicsMill.Codecs.ExifDictionary.Orientation];
The values can be interpreted as following: 1 = The 0th row represents the visual top of the image, and the 0th column represents the visual left-hand side. 2 = The 0th row represents the visual top of the image, and the 0th column represents the visual right-hand side. 3 = The 0th row represents the visual bottom of the image, and the 0th column represents the visual right-hand side. 4 = The 0th row represents the visual bottom of the image, and the 0th column represents the visual left-hand side. 5 = The 0th row represents the visual left-hand side of the image, and the 0th column represents the visual top. 6 = The 0th row represents the visual right-hand side of the image, and the 0th column represents the visual top. 7 = The 0th row represents the visual right-hand side of the image, and the 0th column represents the visual bottom. 8 = The 0th row represents the visual left-hand side of the image, and the 0th column. For detailed information about EXIF and IPTC see here. Edited by user Wednesday, October 29, 2008 2:59:37 PM(UTC)
| Reason: Not specified |
|
|
|
|
Rank: Advanced Member
Groups: Member
Joined: 9/6/2005(UTC) Posts: 106
|
Dmitry, Wow that is great it works like a dream. I sent you a few images that I said that loaded slow they are a little slower now but they are oriented right. Can you make sure that I am doing this correctly and if it is the most efficient? Code: System.UInt32 orientation = 1; Aurigma.GraphicsMill.Codecs.TiffReader
reader = new Aurigma.GraphicsMill.Codecs.TiffReader(filePath);
if (reader.Exif != null)
{
orientation = (System.UInt32)reader.Exif[Aurigma.GraphicsMill.Codecs.ExifDictionary.Orientation];
}
BitmapViewer1.Bitmap.Load(filePath);
if (orientation == 3)
{
BitmapViewer1.Bitmap.Transforms.RotateAndFlip(System.Drawing.RotateFlipType.Rotate180FlipNone);
}
You have been a tremendous help and I appreciate you guys coming thru for me. I hate to be such a pest and I just want to let you know that this is great. I really appreciate all your help. Thanks Chris Edited by user Sunday, December 23, 2007 5:40:31 PM(UTC)
| Reason: Not specified
|
|
|
|
Rank: Advanced Member
Groups: Member, Administration, Moderator Joined: 8/3/2003(UTC) Posts: 1,070
Thanks: 1 times Was thanked: 12 time(s) in 12 post(s)
|
Hello, Unfortunately you load tiff file twice in your sample. Please use code like this: Code:System.UInt32 orientation = 1;
Aurigma.GraphicsMill.Bitmap bitmap = new Aurigma.GraphicsMill.Bitmap();
Aurigma.GraphicsMill.Codecs.TiffReader reader = new Aurigma.GraphicsMill.Codecs.TiffReader(@"d:/images/test/pict0027.tif");
Aurigma.GraphicsMill.Codecs.IFrame frame = reader.LoadFrame(0);
try
{
if(reader.Exif != null)
{
try
{
orientation = (System.UInt32)reader.Exif[Aurigma.GraphicsMill.Codecs.ExifDictionary.Orientation];
}
catch(System.ArgumentException)
{
}
}
frame.GetBitmap(bitmap);
}
finally
{
frame.Dispose();
reader.Dispose();
}
if(orientation == 3)
bitmap.Transforms.RotateAndFlip(System.Drawing.RotateFlipType.Rotate180FlipNone);
bitmapViewer1.Bitmap = bitmap;
Edited by user Sunday, December 23, 2007 5:40:43 PM(UTC)
| Reason: Not specified |
|
|
|
|
Rank: Advanced Member
Groups: Member
Joined: 9/6/2005(UTC) Posts: 106
|
Dmitry,
In this sample I am not sure where I see that I have loaded the bitmap twice in the viewer. Could you point out where I am am loading it twice?
Thanks
Chris
|
|
|
|
Rank: Advanced Member
Groups: Member
Joined: 9/6/2005(UTC) Posts: 106
|
Never mind I am loading in the reader and to the viewer.
Thanks
Chris
|
|
|
|
Rank: Advanced Member
Groups: Member
Joined: 9/6/2005(UTC) Posts: 106
|
Dmitry,
The code sample you sent me does not work with the clients side scripting method. I am not sure whay I am still working on it.
Thanks
Chris
|
|
|
|
Rank: Advanced Member
Groups: Member, Administration, Moderator Joined: 7/28/2003(UTC) Posts: 1,660
Thanks: 5 times Was thanked: 76 time(s) in 74 post(s)
|
Hello Chris, Quote:Chris Herrington (9/15/2005) Dmitry,
The code sample you sent me does not work with the clients side scripting method. I am not sure whay I am still working on it. I am sorry for delay. I was out of office last week. Could you post the entire .aspx and .aspx.cs files in order we checked it. In fact when I placed your code in remote scripting method it worked perfectly for me. Edited by user Friday, May 23, 2008 2:34:20 PM(UTC)
| Reason: Not specified |
Best regards, Fedor Skvortsov
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.