Hi
I was wandering if anyone knew if it was possible to add custom EXIF
tags (such as Photographer and Title) to a JPEG image, or to modify
the existing tags (such as ImageDescription).
There is an extremely good article on Code Project for reading these
tags, but I cannot find any information on how to modify them: http://www.codeproject.com/cs/media/photoproperties.asp
Thanks
Blu. 9 10572
Hi,
[I'm writing this assuming you are using C++ .NET]
this is what I wrote yesterday nite, after I found out you can't create
and assign PropertyItem to an image. I don't know why this behaviour is
by design - makes no sense to me, to go the "save and reload then
modify"-way? Maybe Bob can explain this... ?!?
You have to write a wrapper in C# to retrieve the codec - also a
behaviour by design - and also makes no sense to me, I believe MS
screwed up on this one!
It should be easy to port that code to any other .NET lang...
If you have a problem, drop me a line.
Regards,
Martin
[C#-Wrapper for codec retrievement] public static ImageCodecInfo GetEncoderCodec(string mimetype) { ImageCodecInfo[] codecs=ImageCodecInfo.GetImageEncoders();
ImageCodecInfo ici=null;
foreach(ImageCodecInfo codec in codecs) { if(codec.MimeType==mimetype) { ici=codec; break; } }
return ici; }
[Fill and Write the comment field:] ImageCodecInfo *ici = ImageCodecHelper::GetEncoderCodec("image/jpeg");
EncoderParameters *ep = new EncoderParameters();
// set quality to 70% ep->Param[0]=new System::Drawing::Imaging::EncoderParameter(System: :Drawing::Imaging::Encoder::Quality, (__int64)70);
//this is the way to get the property Items static_cast<Bitmap*>(pBLeft->Image)->Save((Application::StartupPath->Concat(S"\\temp.jpg")), ici, ep); Bitmap *bmp = new Bitmap(Application::StartupPath->Concat(S"\\temp.jpg"));
System::Drawing::Imaging::PropertyItem *pi[] = bmp->PropertyItems;//static_cast<Bitmap*>(pBLeft->Image)->PropertyItems;
//retrieve comment from given Commentfield String *str = m_pbHLeft->GetComment();
//convert to unsigned char array and set
//required fields for unrestricted user comment
unsigned char uc_str __gc[]= new unsigned char __gc [str->Length+8];
//undefined charset for(int i=0; i<8; i++) { uc_str[i] = 0; }
//string data for(int i=0; i<str->Length; i++) { uc_str[i+8] = Convert::ToByte(str->Chars[i]); }
//exif user comment w/o restriction pi[0]->Id = 0x9286; pi[0]->Type = 2; pi[0]->Len = str->Length+8; pi[0]->Value = uc_str;
//Set the Property item to the selected Image static_cast<Bitmap*>(pBLeft->Image)->SetPropertyItem(pi[0]);
//save the image with the properties set static_cast<Bitmap*>(pBLeft->Image)->Save(sfd->FileName, ici, ep);
bmp->Dispose(); File::Delete(Application::StartupPath->Concat(S"\\temp.jpg"));
Hi,
forgot about this, you might want to download this file and have a look
at it. There you will find all the valid tag IDs for the Exif2.2 tags. http://www.exif.org/Exif2-2.PDF
Have fun,
Martin
>forgot about this, you might want to download this file and have a look at it. There you will find all the valid tag IDs for the Exif2.2 tags.
http://www.exif.org/Exif2-2.PDF
Thanks mate. Looks great, unfortunately I only have knowledge of VB,
could you give me a hand on the conversion side please?
Cheers
Blu
I don't know much about VB. But you only have to find the appropriate
calls to the namespace funcs and then replace them... But I will give my
best to support you on this - give it a try and then post the code and
tell me where the problem is... I should be able to help you.
Martin
BluDog wrote: forgot about this, you might want to download this file and have a look at it. There you will find all the valid tag IDs for the Exif2.2 tags.
http://www.exif.org/Exif2-2.PDF
Thanks mate. Looks great, unfortunately I only have knowledge of VB, could you give me a hand on the conversion side please?
Cheers
Blu
Blu,
You can also use an ocx from WaterMarker.
Check on www.watermarker.com and follow the AIS Exif ActiveX. I use it for
reading exif information but it can also be used to write infos.
HTH
Eric
"BluDog" <ne**@nospam.bludog.net> a écrit dans le message de
news:0t********************************@4ax.com... forgot about this, you might want to download this file and have a look at it. There you will find all the valid tag IDs for the Exif2.2 tags.
http://www.exif.org/Exif2-2.PDF
Thanks mate. Looks great, unfortunately I only have knowledge of VB, could you give me a hand on the conversion side please?
Cheers
Blu
Thanks Eric,
but I don't use commercial libraries - it's a codex.
Eric Hourant wrote: Blu, You can also use an ocx from WaterMarker. Check on www.watermarker.com and follow the AIS Exif ActiveX. I use it for reading exif information but it can also be used to write infos.
HTH
Eric
"BluDog" <ne**@nospam.bludog.net> a écrit dans le message de news:0t********************************@4ax.com...
forgot about this, you might want to download this file and have a look at it. There you will find all the valid tag IDs for the Exif2.2 tags.
http://www.exif.org/Exif2-2.PDF
Thanks mate. Looks great, unfortunately I only have knowledge of VB, could you give me a hand on the conversion side please?
Cheers
Blu
Martin
I have converted the C# wrapper bit to VB no probs:
Public Shared Function GetEncoderCodec(ByVal mimetype As String) As
ImageCodecInfo
Dim codecs() As ImageCodecInfo =
ImageCodecInfo.GetImageEncoders()
Dim codec As ImageCodecInfo
For Each codec In codecs
If codec.MimeType = mimetype Then Return codec
Next
End Function
But the rest, this is C++, i am assuming from your post that this can
only be acheived using C++ and cannot be converted to VB?
Is this correct?
Cheers
Blu
Hi,
no this is all .Net standard stuff. You don't have to worry about quit a
lot of things like the pointer stuff. This is normal object as it is in
VB. Give it a try, you should encounter no problems.
I'm leaving office now, if you have any further questions on this, I
will answer them tomorrow morning.
Martin
BluDog wrote: Martin
I have converted the C# wrapper bit to VB no probs:
Public Shared Function GetEncoderCodec(ByVal mimetype As String) As ImageCodecInfo
Dim codecs() As ImageCodecInfo = ImageCodecInfo.GetImageEncoders() Dim codec As ImageCodecInfo
For Each codec In codecs If codec.MimeType = mimetype Then Return codec Next
End Function
But the rest, this is C++, i am assuming from your post that this can only be acheived using C++ and cannot be converted to VB?
Is this correct?
Cheers
Blu
check out LEADTOOLS ( www.leadtools.com), it can handle that no problem.
"BluDog" <ne**@nospam.bludog.net> wrote in message
news:ol********************************@4ax.com... Hi
I was wandering if anyone knew if it was possible to add custom EXIF tags (such as Photographer and Title) to a JPEG image, or to modify the existing tags (such as ImageDescription).
There is an extremely good article on Code Project for reading these tags, but I cannot find any information on how to modify them:
http://www.codeproject.com/cs/media/photoproperties.asp
Thanks
Blu. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Tommy |
last post by:
Hi.
I try to use PEL (pel.sourceforge.net) to copy some exif information from
orginial camera jpeg to resized copy with php gd library. But without
success:(
1) File is uploaded to server...
|
by: leo |
last post by:
hi there
i'm using gene cash's EXIF.py module to find out the shoting time of an jpeg
image.
this module works usually like a beauty, but some images raise an exception:
Traceback (most...
|
by: Vladish |
last post by:
Hi all,
I wonder, if anybody here has any source code or component, which can
read EXIF informations from JPEG pictures. Or some good, easy to
understood, description of JPEG files. I didn't...
|
by: BluDog |
last post by:
Hi
I was wandering if anyone knew if it was possible to add custom EXIF
tags (such as Photographer and Title) to a JPEG image, or to modify
the existing tags (such as ImageDescription).
There...
|
by: TheGanjaMan |
last post by:
Hi everyone,
I'm trying to write up a simple image stamper application that stamps the
Exif date information from the jpegs that I've taken from my digital
camera and saves the new file with the...
|
by: Bror Johansson |
last post by:
Is there somewhere some Python-module that can be used for adding EXIF-info
to JPEG files?
(Modules for extraction of EXIF-data are easily found, but lacks - as I see
it - capacity to add new...
|
by: Frank |
last post by:
I see that ImageFormat includes exif.
But I can't find out if
I've System.Drawing.Image.FromStream
or something like it
can read and/or write that format.
|
by: infoseekar |
last post by:
Does anyone know what's the right code to read IPTC metadata.
I have the code to read EXIF metadata and it gives me alot of information which I don't need. How do I modify this code so it only...
|
by: SPE - Stani's Python Editor |
last post by:
Phatch is a simple to use cross-platform GUI Photo Batch Processor
Phatch handles all popular image formats and can duplicate (sub)folder
hierarchies. It can batch resize, rotate, apply...
|
by: tlhintoq |
last post by:
I'd like to think I can work out most issues, but this one is kicking my butt.
What's worse, is that I know I can't be the first guy to want to add a thumbnail to jpg that doesn't already have one. ...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |