Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Bit Depth in XMP

Explorer ,
May 30, 2008 May 30, 2008
Does anybody know of anyway of determining the bit depth of an image from it's
XMP? I know that raw files has a BitsPerSample property which I can deal with.
My problem is more with PSD files. I can't figure any way of determining whether
it's an 8 bit or 16 bit image strictly from the XMP data.

Anyone have any ideas?

-X
TOPICS
Scripting
1.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Jun 26, 2008 Jun 26, 2008
Hi X,

I think a more reliable approach to try would be get the bit depth discovered while Bridge looks at the actual image data during thumbnail and preview generation.

You can access this data from the Bridge cache through Thumbnail.core.quickMetadata.bitDepth -- but you will want to do it after a preview has been generated.

Try saving the following example script in a folder of PSD files and running it from ESTK:

#target bridge

function testBitDepth( testFile )
{
var testThumb = new Thumbnail( testFile );

var bitDepthBefore = testThumb.core.itemContent.bitDepth;

//force preview generation, if it hasn't happened yet
app.synchronousMode = true;
testThumb.core.preview.preview;
app.synchronousMode = true;

// retreive bit depth from the cache
var bitDepth = testThumb.core.quickMetadata.bitDepth;
$.writeln("Bit Depth for: " + testThumb.name + " is " + bitDepth + " (before: " + bitDepthBefore + ")" );
}

var curFolder = new File( $.fileName).parent;
var psdFiles = curFolder.getFiles("*.psd");

for( var f = 0; f < psdFiles.length; ++f )
{
var testFile = psdFiles;
try{
testBitDepth( testFile );
}catch( e ) {
$.writeln("Doh! Error testing " + testFile.name + " " + e );
}
}

This method should work for any file for which you can also see a bit depth reported in the "File Properties" section of the Bridge metadata panel.

Cheers,
David
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 26, 2008 Jun 26, 2008
> This method should work for any file for which you can also see a bit depth reported in the "File Properties" section of the Bridge metadata panel.

Thanks for this. I guess I shoulda searched for 'bitDepth' in the docs :)
My code is using BitsPerSample from XMP at the moment, but that's nowhere near
universal. I'll see if I can make this fit.

-X
--
for photoshop scripting solutions of all sorts
contact: xbytor@gmail.com
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Jun 27, 2008 Jun 27, 2008
There is a typo in my example. The part that gets the preview should look like this:

//force preview generation, if it hasn't happened yet
app.synchronousMode = true;
testThumb.core.preview.preview;
app.synchronousMode = false;

You can turn OFF synchronousMode after preview generation.

-David
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 27, 2008 Jun 27, 2008
> You can turn OFF synchronousMode after preview generation.

Got it. Thanks.

--
for photoshop scripting solutions of all sorts
contact: xbytor@gmail.com
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 30, 2008 Nov 30, 2008
LATEST
Got it!

Good Luck.
______
My Si tes
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines