Transparency on PSB/PSD with Maximize Transparency/Maximize Compatibility Off

Started by Chris S, April 12, 2023, 01:52:59 PM

Previous topic - Next topic

Chris S

Is there a way to find if a PSB or PSD image has Transparency if the Maximize Compatibility (MC) is unselected (off) when the image is saved in Photoshop?

Issue:
Take two identical PSD files with transparency, save one with Maximize Compatibility checked and the other unchecked. The PSD with it checked will return Transparency under -AlphaChannelsNames, while the unchecked version does not return anything for this. I could not find another tag that would help me see if transparency is present with MC off.

Observations:
  • I thought -MDItemHasAlphaChannel may be helpful, but this only suggests the presence of ANY alpha channel, not specifically Transparency.
  • -HasRealMergedData is "No" when the file was saved with Maximize Compatibility off.
  • -NumChannels returns the number of channels including transparency with Maximize Compatibility on, while it does not include transparency in the count with it off.

The code below reflects the results of what I thought would be helpful tags, where:
- On = Max Compatibility On (Checked)
- Off = Max Compatibility Off (Unchecked)

Sample images attached for reference: MaxCompatibility.zip *

* The file named Off_Trans_NoAlpha.psd is the focus, while the others are support. The equivalent to that is On_Trans_NoAlpha.psd, which will report the transparency.

> exiftool -G1 -api requestall=3 -filename '-*alpha*' '-*channel*' [DIR]
========
[System]        File Name                      : Off_NoTrans_NoAlpha.psd
[MacOS]        MD Item Has Alpha Channel      : 1
[MacOS]        MD Item Has Alpha Channel      : 1
[Photoshop]    Num Channels                    : 3
========
[System]        File Name                      : On_NoTrans_WithAlpha.psd
[MacOS]        MD Item Has Alpha Channel      : 1
[Photoshop]    Alpha Channels Names            : Alpha 1
[MacOS]        MD Item Has Alpha Channel      : 1
[Photoshop]    Num Channels                    : 4
[Photoshop]    Alpha Channels Names            : Alpha 1
========
[System]        File Name                      : On_Trans_NoAlpha.psd
[MacOS]        MD Item Has Alpha Channel      : 1
[Photoshop]    Alpha Channels Names            : Transparency
[MacOS]        MD Item Has Alpha Channel      : 1
[Photoshop]    Num Channels                    : 4
[Photoshop]    Alpha Channels Names            : Transparency
========
[System]        File Name                      : Off_Trans_WithAlpha.psd
[MacOS]        MD Item Has Alpha Channel      : 1
[Photoshop]    Alpha Channels Names            : Alpha 1
[MacOS]        MD Item Has Alpha Channel      : 1
[Photoshop]    Num Channels                    : 4
[Photoshop]    Alpha Channels Names            : Alpha 1
========
[System]        File Name                      : On_Trans_WithAlpha.psd
[MacOS]        MD Item Has Alpha Channel      : 1
[Photoshop]    Alpha Channels Names            : Transparency, Alpha 1
[MacOS]        MD Item Has Alpha Channel      : 1
[Photoshop]    Num Channels                    : 5
[Photoshop]    Alpha Channels Names            : Transparency, Alpha 1
========
[System]        File Name                      : Off_Trans_NoAlpha.psd
[MacOS]        MD Item Has Alpha Channel      : 1
[MacOS]        MD Item Has Alpha Channel      : 1
[Photoshop]    Num Channels                    : 3
========
[System]        File Name                      : Off_NoTrans_WithAlpha.psd
[MacOS]        MD Item Has Alpha Channel      : 1
[Photoshop]    Alpha Channels Names            : Alpha 1
[MacOS]        MD Item Has Alpha Channel      : 1
[Photoshop]    Num Channels                    : 4
[Photoshop]    Alpha Channels Names            : Alpha 1
    1 directories scanned
    7 image files read

StarGeek

I can't really help, as I don't deal with these file types, but it needs pointing out that MDItemHasAlphaChannel is a Mac only file system tag.  It's not embedded in the file itself.  No idea how it gets set, whether the OS checks the file to set, which seems to be an oddly specific operation for an OS to handle, or the program that saves the file would have to set it.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

blue-j

I've worked a lot on this, and in my experience, background transparency is always called "Transparency" as an alpha hidden from the user in the channels panel, whether or not MC is checked.  I need to look at your samples, but perhaps you are conflating transparency with background transparency?  Background transparency in Photoshop terms means you see the checkerboard when you open it.   - J

blue-j

I've had a look. I think my prior post contains all the answers you're looking for, albeit in quite compacted form.  Let me know if you have any questions.  : )

- J

Chris S

@blue-j, yes, background transparency is what I am referring to.

When a file is saved with Maximize Compatibility on, you can determine the background transparency state because "Transparency" shows up under the -AlphaChannelsNames tag.

When saved with Maximize Compatibility off, "Transparency" doesn't show up here.

Trying to figure out how I can determine if the file was saved with background transparency with Maximize Compatibility off.

If the background was a complete fill, this could be done with the layer rectangles, ie 800x800px with 0 0 800 800 layer rectangles would indicate that there is at least a pixel at all 4 corners of the image, increasing the likelihood that it doesn't have transparency. However, if there is a transparent hole in the middle of the image for example, that wouldn't be accounted for. This is isn't foolproof for multilayer images either.

blue-j

I stand corrected!  Thank you for bringing this to my attention; this is a great catch.  It may possibly be a bug in ExifTool (soooo rare!), confusing the absence of the merged data (MC flat version of the file) as the absence of a channel.  I'll investigate further, please continue as well!

If you are in hot water, we use ImageMagick to test for opaqueness to determine background transparency in addition to other checks:

magick filename.ext -format '%[opaque]' info:

if there is "False" present in the output, then it has background transparency, in my experience.

- J

blue-j

PS Chris, you should change the thread title if you can to "Maximize Compatibility"

StarGeek

Quote from: blue-j on April 18, 2023, 01:37:27 PMPS Chris, you should change the thread title if you can to "Maximize Compatibility"

I went ahead and just added it instead of replacing it. Hopefully either will pop up in a search in the future.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Chris S

I submitted a request with Adobe Enterprise Support to include background transparency metadata with PSD/PSBs that have "Maximize Compatibility" turned off. Supposedly it's in the queue... whether or not they take it up, or when, is anyone's guess. In the meantime, I've asked our image parters to have Maximize Compatibility set to ALWAYS ON in their Photoshop settings.