Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Photoshop's clipboard format is horrible. The only pretty valid data that contains the alpha channel stored into the clipboard is... guess? ... a pointer to the alpha channel's memory into the "Photoshop Paste In Place" chunk.... HORRIBLE. If you copy something then restart photoshop, the alpha is... lost :)</p> <p>However, you can easily understand if the clipboard contains Photoshop image.</p> <p>Ask the Clipboard what chunks it have.</p> <p>If the clipboard have two chunks, named <em>"Photoshop Paste In Place"</em> AND <em>"Object Descriptor"</em>, you <em>can be 99.9% sure</em> that Photoshop <em>IS RUNNING</em> on the system AND Clipboard contains <em>reference</em> to Photoshop data. (When Photoshop quits, the Object Descriptor chunk gets removed from the Clipboard, so the alpha is lost forever)</p> <p>So then, you have two choices: </p> <p><strong>Choice 1 (not recommended):</strong> Open Photoshop's Process Memory and read the raw 32-bit image data from the pointer... which is overall idiotic to do <em>and unsecure</em>, <strong>or</strong> </p> <p><strong>Choice 2 (recommended): Use COM</strong> to extract the image data from Photoshop. Of course, the COM method is the best way. Make your program generate and run the following <strong>VBS</strong> script:</p> <pre><code>On Error Resume Next Set Ps = CreateObject("Photoshop.Application") Set Shell = CreateObject("WScript.Shell") Set FileSystem = CreateObject("Scripting.FileSystemObject") Dim PNGFileName PNGFileName = Shell.CurrentDirectory &amp; "\psClipboard.png" If FileSystem.FileExists(PNGFileName) Then FileSystem.DeleteFile PNGFileName End If Set Doc = Ps.Documents.Add(1,1,72,"psClipboard",,3) Doc.Paste() Doc.RevealAll() If Err.Number = 0 Then set PNGSaveOptions = CreateObject("Photoshop.PNGSaveOptions") doc.saveAs PNGFileName, PNGSaveOptions End If doc.Close() </code></pre> <p>In the script's CurrentDirectory, a file names "<em>psClipboard.png</em>" will be generated. Read this file in your program using libPng or whatever, and treat is as if it was come from the Clipboard. This script will DELETE the <em>psClipboard.png</em>, then will ask Photoshop for it. In case a Paste returns Error, the script will cease and the file will not be generated, in which case, Clipboard didn't contained valid Photoshop reference data.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload