View Full Version : PS: Scripting exif info into image
toddb
15th of April 2005 (Fri), 13:23
I've been wanting to learn a little javascript for a while now and thought scripting for Photoshop would be a cool way to learn. I found this script online as a sample script but it only showed the shutter speed. I added some other info to it. I hacked out the lens info form the xmp data as well. I wanted a quick way to post my photo settings on a web ready image.
To use this script, place it in your script dir
C:\Program Files\Adobe\Photoshop CS\Presets\Scripts
then restart Photoshop so it will see it. Open an image ready to be posted to the web and click file in the menu then "scripts". This one will be called "CS_exif".
It's pretty crude but I hope to update it when I get some free cycles. I need to modify it to take in a whole folder of images and resave them out. Just thought it might come in useful. You can open it with a text viewer like notepad and put you name for the "name here" text. Here is an example:
http://pws.cablespeed.com/~toddb/forumpost/CRW_6300.jpg
Download JS here (http://pws.cablespeed.com/~toddb/forumpost/CS_exif.js)
I originally got the script from here: http://mlkdesign.online.fr/tutorials/scripting/scripting6_1.html
And they pulled parts from the Adobe forums.
ssim
15th of April 2005 (Fri), 23:49
That is a neat concept. I copied your file and tried it. I'm pretty thick when it comes to programming this kind of stuff. It didn't work for me. I got the following error. I take it to mean that the lens info wasn't present.
The image in question was shot in raw and then post processed using RSE and the file I was using was a TIFF.
toddb
16th of April 2005 (Sat), 00:13
To get the lens info, I really hacked out the rawdata form the xmp part of the image data. I mean really hacked so I'm not surprised. You can try commenting out that part. Here, I'll post it with out the lens info part. This will just retrieve the normal exif data stuff. I really don't know this stuff either, but I'd thought it would be fun to give it a go. I can already tell that Adobe could defiantly add to the existing api, especially in terms of retrieving this xmp data stuff. I'll have to come up with a better parser to get the info out. Who knows how long that will take me if I ever get any time.
CS_exif_2.js (http://pws.cablespeed.com/~toddb/forumpost/CS_exif_2.js)
tim
16th of April 2005 (Sat), 00:17
That's pretty cool :)
toddb
16th of April 2005 (Sat), 00:27
I just tried this on a JPEG file (had to go back a year it's been a while since I've shot any jpeg images) but found that the lens info isn't there on the jpeg...only if the image was originally shot RAW. Weird. I didn't realize less camera info was produced with shooting jpeg then with RAW. Didn't we go over this before and found that there wasn't a difference. But clearly when I look that the camera info, I can't find the lens info (other then the current focal length) in the xmp viewer. Got me, I don't know. <shrug>
So the first one will probably work on a file that started from a raw image. Most of the ones I'm applying this to have been converted to jpeg for the web long ago, so the info must have been maintained.
toddb
19th of April 2005 (Tue), 02:52
I added another script that now writes the data up along the side after expanding the canvas to allow for the text. Here is a sample. Again, I just started looking at JavaScript last weekend so hopefully they will get better. You'll want to run it on an open image that is ready for web posting (normal web size). I thought it would be cool to have some of the image info when discusing these images online. Like the below image you can see that I had really low light, iso 800 and f2.5.
http://pws.cablespeed.com/~toddb/forumpost/CRW_8986.jpg
You can download the script here (http://pws.cablespeed.com/~toddb/forumpost/photo_shop_scripts.htm).
tonychien
8th of May 2005 (Sun), 11:41
Yes you can do it by photoshop script code. DigitalFilm 1.65 (http://www.opanda.com/en/df/) can do it easier without other tools, you can peruse the quoted passage.;)
Easy Job to Stamp Date in a Heap of Photos
Many film cameras can stamp date in photo, and several digital camera can do it, too. But, it will be a piece of work stamping date in a heap of photos for lots of users whose camera cannot support the feature. You will be crazy with the stuffy and tedious work.
Now, let DigitalFilm do it for you!
First, open a image in DigitalFilm 1.65, select "Signature" panel, click "Insert image & EXIF parameter" menu and choose "ShotDate" item. Of course, you may type "<ShotDate/>" in textbox instead. Then adjust font, color and location, click "apply", the values of shotdate will be stamped in the photo.
You must be sure that EXIF data of image is whole before doing it. If the Exif data in image file is losted, you can add exif data & modify it for image file by Opanda PowerExif Editor (http://www.opanda.com/en/pe/).
We know, shotting date and time of every photo is different. Stamping date for a heap of photos will make you crazy.
It's a piece of cake for DigitalFilm. DigitalFilm supply the feature of batch process to insolve the problem. As above operation, type macro order "<ShotDate/>", DigitalFilm will stamp date for each photo intelligently. You can think about it'll be so difficult to do it manually.
Certainly, this just is one of all features in DigitalFilm. You may try & discover the other feature, for example, digital reversal film, index sample, frame, EXIF Maker and so on if you are interested with DigitalFilm.
Download: http://www.opanda.com/en/df/index.html (http://www.opanda.com/en/df/index.html)
Tips: It will be lifeliker if you set signature FONT as electronic.
RTMiller
10th of May 2005 (Tue), 11:23
These scripts are really neat!
Does anyone know how to edit the code so it won't display a decimal point in the lens and focal length info (eg., 100-400mm instead of 100.0-400.0mm)?
toddb
10th of May 2005 (Tue), 14:57
I might get some time this weekend and I can try and trim those decimal points off (they are what's in the meta data). I've also upgraded to CS2 and found some problems with using these scripts with it. For one, "Arial" is now "ArialMT" and it measures the distance from inside the working area instead of outside so the possitioning isn't quite right either anymore.
Rob612
15th of May 2005 (Sun), 14:03
I have to apologize... I've been using your script for a short while and never thanked you for sharing it. I'll do it now because its really a nice piece to have.
oloughlinc
15th of May 2005 (Sun), 18:12
Thanks for the scripts - it's a nice touch, and soooo easy...at least on this end due to your effort.
hauff
15th of May 2005 (Sun), 19:49
These scripts are great. Thanks so much for sharing them. Looks like a lot of work on your part so we can enjoy. Thanks again.
acidhouse
16th of May 2005 (Mon), 07:06
thanks, these work great
fetching
24th of May 2005 (Tue), 15:55
i am using Photoshop 6.0 at work, but when i go to download them into the scripts folder, there is no scripts folder. Where else would they go, or can i not use them with PS 6.0?
Keiffer
24th of May 2005 (Tue), 19:22
I take it thsese don't work in CS? I tried with Jpg and Raw and it's not adding it to the pics. :-(
EOSAddict
27th of May 2005 (Fri), 15:57
i am using Photoshop 6.0 at work, but when i go to download them into the scripts folder, there is no scripts folder. Where else would they go, or can i not use them with PS 6.0?
Snap! And is it a silly question to ask if they will work in PSE3?
Vetteography
27th of May 2005 (Fri), 16:06
I take it thsese don't work in CS? I tried with Jpg and Raw and it's not adding it to the pics. :-(
It works just fine in CS, ( the image_data_cs.js file that is...)
Moppie
27th of May 2005 (Fri), 17:08
Iv been looking for an easy to use one of these, I had one for PS 6 that never really worked properly, but I can't seem to find the script option in PS 7?
Keiffer
29th of May 2005 (Sun), 14:16
I'm still getting an error 21 What am I doing wrong? I've tried all of them but I just tried the CS js and still no go.
lomond
29th of May 2005 (Sun), 14:59
Thanks for the script.
I like it and it works well in CS for RAW files. :)
EOSAddict
30th of May 2005 (Mon), 05:24
Silly question - does it work in PSE3?
scr7b
1st of June 2005 (Wed), 16:52
This isn't working in Photoshop 7, does anyone know why? Maybe some variable naming differences?
toddb
1st of June 2005 (Wed), 23:22
I don't know PS scripting well enough to know what's going on in the earlier versions. These scripts needed to be tweaked from CS to CS2, so there might be allot of things different even more so with versions before CS. Also remember that I made these for my 10D and pulling EXIF data from those files. I haven't tried anything else. These aren't the best examples of how to write code, but they are something I tried to put to gether as fast as I could. Really, someday I'll spend more time making them right.
I've updated CS2 so here are the updated versions of those scripts. They changed the measurement of how the calculate distances from the edge...I guess they were doing it from the outside and now it's the inside of the canvas (don't ask). Anyway, it make the text not line up right. There was also a problem with the font naming that had changed as well that was (on my machine) no longer valid when I updated.
CS2_dateit.js (http://pws.cablespeed.com/~toddb/ps_scripts/CS2_dateit.js)
CS2_exif.js (http://pws.cablespeed.com/~toddb/ps_scripts/CS2_exif.js)
image_data_cs2.js (http://pws.cablespeed.com/~toddb/ps_scripts/image_data_cs2.js)
No guarantees, might work for you might not.
vBulletin® v3.6.12, Copyright ©2000-2012, Jelsoft Enterprises Ltd.