4 Replies Latest reply on Apr 19, 2015 6:41 PM by brettjrob

    [CS5] Changing bit depth of ACR SmartObjects via script?


      I'm new to PS scripting, but not to programming or JavaScript, so I've generally been able to piece together code for the simple tasks I need to run on my files. I'm stumped on this one, though -- I imagine there's a good chance it can't be done, but hopefully one of you wizzes here can help.


      Background: I'm a photographer who shoots RAW and opens my RAWs as ACR SmartObject layers, then saves my edited files as TIFs with said layers. For years, I ignorantly chose to do 8-bit conversions in ACR, rather than 16-bit. I've accumulated somewhere close to 1000 edited TIF files now which contain ACR SmartObject layers whose conversion settings are set to 8-bit.


      Task: For all these files, I need to change the bit depth within ACR on the SmartObjects to 16-bit. Note that this is not simply changing the document bit depth within PS. Here's what I mean:




      After searching this forum, I found this thread which cleverly addresses how to script ACR image edits (such as exposure, color temp, etc.) by manipulating XMP data. Unfortunately for me, it looks like the parameters set via the ACR "Workflow Options" dialog -- color space, bit depth, size, and resolution -- are not actually stored in XMP.


      According to the thread I linked, it is not possible to script anything within the ACR interface, which doesn't bode well for my task. Naturally, if I use the ScriptListener plugin and perform the actions shown in the image above, it doesn't have any record of what I did within the ACR dialog -- just that it was opened and changes were made to the layer.


      Still, this seems like such a simple task that there has got to be some way of automating it. If not, I will likely have to spend over a dozen hours manually opening 1000+ large TIFs with multiple SmartObject layers apiece and changing each layer's bit depth.

        • 1. Re: [CS5] Changing bit depth of ACR SmartObjects via script?
          JJMack Most Valuable Participant

          I don't think you would accomplish much if you do change the objects color bit depth. For a document can not have different bit depth layers.  The Pixels generated for the smart object layers would will be for the color depth the document has.

          • 2. Re: [CS5] Changing bit depth of ACR SmartObjects via script?
            brettjrob Level 1

            Hi JJ, thanks for the reply. Actually, I've experimented with ACR SmartObjects quite a bit and have concluded that the selection of ACR bit depth *does* affect the final product.


            For example, suppose one opens a RAW file in ACR after choosing 8-bit under ACR Workflow Options. Then, after the file is open in PS, change the document color depth to 16-bit and save. This still results in a low-quality image wherein even though your PS document is 16-bit, the actual pixel RGB values will only come from the set of 2^8 values rendered by ACR. In effect, you have a "fake" 16-bit image with a large file size but limited information and potentially posterization.


            The only way to obtain a "real" 16-bit image in the scenario I just described is to make sure your PS document is 16-bit *and* change the ACR SmartObject bit depth to 16-bit. For me, as soon as I do the latter, the image is re-rendered (it takes 5-10 seconds to do, so I know something is happening).


            To be clear: I've verified all this by comparing the pixel-by-pixel difference of images generated using various combinations of options between PS and ACR.

            • For my "control" image, I opened the RAW file in ACR, selected 16-bit in Workflow Options, and this was placed into a 16-bit PS document. Clearly, this is a "real" 16-bit image.
            • (Test #1) I re-opened the RAW in ACR, but selected 8-bit in Workflow Options. Once in PS, I changed the document to 16-bit and saved. The resulting image was not pixel-identical to the control image.
            • (Test #2) I opened image #1 and manually edited the ACR SmartObject layer, changing to 16-bit in Workflow Options. After re-rendering and saving, the resulting image was pixel-identical to the control image.


            Hope that makes some sense! The takeaway is that I'm fairly certain changing the bit depth in Workflow Options for my ACR SmartObject layers will improve image quality and reduce the chances for posterization.

            • 3. Re: [CS5] Changing bit depth of ACR SmartObjects via script?
              JJMack Most Valuable Participant

              Yes if you change the mode to 16bit before reprocessing the smart object and the smart object the color can be improved if the object is a RAW.  I would wander about control I think it would be interactive and require human interaction.


              The image processor script does have a RAW option. It can open the first RAW file through ACR and its UI. Where the following  RAW file will be processed using the setting you created for the first RAW file  so settings can be passed to ACR opening a RAW file.  However I do not think you would be able to get into control like The image Process which process files and is in control before the files are open. When a smart object layer in the layers palette contents gets doubled clicked on. If the object is an embedded RAW File Photoshop will copy the raw file to your temp folder the open it if its will be opened via ACR and the ACR GUI will open in it there will only be an OK and Cancel button. You can not save the image all you can do is changes the ACR setting via OK or leave them be VIA cancel. Photoshop will save the smart object layers ACR settings if you click OK and generate new pixels for the smart object layer the documents bit depth will not change.

              You also may not have to change the ACR bit depth they may have been 16bit but  the smart object  layers pixels generated by Photoshop were 8bit because  of the documents current bit depth,

              • 4. Re: [CS5] Changing bit depth of ACR SmartObjects via script?
                brettjrob Level 1

                JJ - interesting info re: the RAW files being placed in Temp when a SmartObject is double-clicked. I've verified that and will look further into whether that could lead to a possible solution.


                As far as the need to change the ACR bit depth: I'm certain that I want the ACR ("Workflow Options") value to be 16-bit in all my master files. My workflow is probably rather unusual, but here's what I'm doing nowadays: I open the RAW file in ACR with the Workflow Options value set to 16-bit, which upon conversion is placed into a 16-bit PS document. I perform edits, then when I'm finished, I convert the PS document to 8-bit and save as TIF. The result is a TIF "master file" that's manageable in size (200-300 MB, even with several layers and Smart Filters). From this 8-bit TIF, I can reconstruct the image in its full 16-bit glory simply by opening it, changing the PS document bit depth to 16-bit, and waiting for the Smart Objects and Smart Filters to redraw. A key point to note is that even though my saved document is 8-bit, the ACR objects embedded as layers are set as 16-bit, and are therefore ready to write out the full 16-bit data as soon as the PS document bit depth is increased.


                This probably sounds insanely overcomplicated, but here's the deal: because I typically use multiple ACR SmartObject layers with layer masks, in addition to Smart Filters with masks of their own, saving as a 16-bit TIF can easily result in file sizes on the order of 1 GB. It doesn't take many years of doing things that way before even large HDDs start to fill up. I've found that this "sneaky" method of saving as 8-bit, then reconstituting the 16-bit conversion on demand later on if needed, strikes the right balance of file size vs. final image quality. The only downside is the wait time of ~10 sec. when the PS document is switched back to 16-bit.


                The crux of my problem is that up until a couple years ago, I didn't realize the importance of working in 16-bit mode at all, so I have 1000+ documents where both the ACR and PS bit depth is only 8-bit. The upside is that because I always saved my files with ACR SmartObject layers, I can obtain true 16-bit master files simply by changing the ACR Workflow Options for each layer within any given file. The downside is that doing this manually for every file will take an absurd amount of time, given the simplicity of the task, unless scripting can be used.