Rank: Member
Groups: Guest
Joined: 8/15/2006(UTC) Posts: 13
|
I tried to run the following code which is available in the site. The code did run with out any problem and I can also open the created image using sample metadata application comes with the library. But when I tried to open it with Photoshop I got the following error. “unexpected end-of-file was encountered” When I commented out metadata writing sections all seems to work fine. It is very strange why the images can not be open with photoshop. I would appriceate any advice on this matter. Code: using (Aurigma.GraphicsMill.Bitmap bitmap =
new Aurigma.GraphicsMill.Bitmap(@"C:\Temp\zion-maple-1.jpg"))
{
Aurigma.GraphicsMill.Codecs.JpegEncoderOptions encoderOptions =
new Aurigma.GraphicsMill.Codecs.JpegEncoderOptions(100, false);
//EXIF
Aurigma.GraphicsMill.Codecs.ExifDictionary exif =
new Aurigma.GraphicsMill.Codecs.ExifDictionary();
exif[Aurigma.GraphicsMill.Codecs.ExifDictionary.Software] = "Aurigma Graphics Mill";
encoderOptions.Exif = exif;
//IPTC
Aurigma.GraphicsMill.Codecs.IptcDictionary iptc =
new Aurigma.GraphicsMill.Codecs.IptcDictionary();
iptc[Aurigma.GraphicsMill.Codecs.IptcDictionary.Category] = "Nature";
iptc[Aurigma.GraphicsMill.Codecs.IptcDictionary.CopyrightNotice] = "Aurigma Inc.";
iptc[Aurigma.GraphicsMill.Codecs.IptcDictionary.Keyword] = "mountain";
encoderOptions.Iptc = iptc;
bitmap.Save(@"C:\Mountain2.jpg", encoderOptions);
}
Edited by user Wednesday, December 19, 2007 2:51:14 PM(UTC)
| Reason: Not specified
|
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 8/3/2003(UTC) Posts: 1,070
Thanks: 1 times Was thanked: 12 time(s) in 12 post(s)
|
Hello, We confirm the issue, there are some problems with saving IPTC. The update will be available with next release of Graphics Mill for .NET. If this issue is critical for you, please submit case. Edited by user Thursday, May 22, 2008 9:38:48 PM(UTC)
| Reason: Not specified |
|
|
|
|
Rank: Member
Groups: Guest
Joined: 8/15/2006(UTC) Posts: 13
|
Any good news on this issue guys?
Janaka
|
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 8/3/2003(UTC) Posts: 1,070
Thanks: 1 times Was thanked: 12 time(s) in 12 post(s)
|
Hello Janaka, The problem is in that IPTC specification doesn't allow category strings more than 3 symbols length. So if you replace line Code:iptc[Aurigma.GraphicsMill.Codecs.IptcDictionary.Category] = "Nature";
by Code:iptc[Aurigma.GraphicsMill.Codecs.IptcDictionary.Category] = "Nat";
everything works fine. I have forwarded this issue to developer and the problem will be fixed - all category strings will be trimmed automatically while saving. To solve this problem with current compilation you should limit length of category strings by 3 symbols. Edited by user Wednesday, December 19, 2007 2:51:45 PM(UTC)
| Reason: Not specified |
|
|
|
|
Rank: Member
Groups: Guest
Joined: 8/15/2006(UTC) Posts: 13
|
I have done the following to get the program working, since we don’t need all the IPTC fields. So I manually set all the fields. In our original images there is a field that shows the Image URL. When you check from Photoshop it shows URL of client’s website. Since he sell images online it is very important that we set that field in all the images. I could not find that field. If I can set that field everything should be fine. Can you tell how to access that field? I really appreciate your effect in helping me. Best regards, Janaka Code: Aurigma.GraphicsMill.Codecs.ExifDictionary exif = null;
Aurigma.GraphicsMill.Codecs.IptcDictionary iptc = null;
Aurigma.GraphicsMill.Codecs.JpegEncoderOptions encoderOptions = new Aurigma.GraphicsMill.Codecs.JpegEncoderOptions(70, false);
using (Aurigma.GraphicsMill.Codecs.JpegReader jpegReader = new Aurigma.GraphicsMill.Codecs.JpegReader(strSourceFileName))
{
iptc = jpegReader.Iptc;
exif = jpegReader.Exif;
}
if (exif == null)
{
exif = new Aurigma.GraphicsMill.Codecs.ExifDictionary();
}
if (iptc == null)
{
iptc = new Aurigma.GraphicsMill.Codecs.IptcDictionary();
}
encoderOptions.Iptc = new Aurigma.GraphicsMill.Codecs.IptcDictionary();
try
{
encoderOptions.Iptc[Aurigma.GraphicsMill.Codecs.IptcDictionary.Byline] = iptc[Aurigma.GraphicsMill.Codecs.IptcDictionary.Byline];
encoderOptions.Iptc[Aurigma.GraphicsMill.Codecs.IptcDictionary.Caption] = iptc[Aurigma.GraphicsMill.Codecs.IptcDictionary.Caption];
encoderOptions.Iptc[Aurigma.GraphicsMill.Codecs.IptcDictionary.CopyrightNotice] = iptc[Aurigma.GraphicsMill.Codecs.IptcDictionary.CopyrightNotice];
encoderOptions.Iptc.SetItemArray(Aurigma.GraphicsMill.Codecs.IptcDictionary.Keyword, iptc.GetItemArray(IptcDictionary.Keyword));
encoderOptions.Iptc[Aurigma.GraphicsMill.Codecs.IptcDictionary.ObjectName] = iptc[Aurigma.GraphicsMill.Codecs.IptcDictionary.ObjectName];
}
catch (Exception) { }
encoderOptions.Exif = exif;
Aurigma.GraphicsMill.Bitmap srcBitmap = new Aurigma.GraphicsMill.Bitmap(strSourceFileName);
srcBitmap.Save(strDest, encoderOptions);
Edited by user Wednesday, December 19, 2007 2:52:38 PM(UTC)
| Reason: Not specified
|
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 8/3/2003(UTC) Posts: 1,070
Thanks: 1 times Was thanked: 12 time(s) in 12 post(s)
|
Hello.
Adobe Photoshop image info fields are saved into several places of JPEG file. They are: EXIF, IPTC, Adobe Resources and XMP. Current compilation of Graphics Mill for .NET supports EXIF and IPTC only. Unfotunately Photoshop stores value of URL field into xapRights:WebStatement tag of XMP which is not supported at this moment. |
|
|
|
|
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.