I am planning a script that will recalculate the canvas height from the active document.
The script will get the canvas height from the active document, then get the number of layers from the active document.
Next multiply the canvas height by the number of layers.
Then apply the new canvas height to the active document and expand the canvas upwards (canvas dialog ancho grid)
How would I get the active document canvas height and layer number?
How would I pass the new canvas height value to the active document?
???. Layers can be any size. They can be larger, smaller and have different aspect ratios then the document canvas. layers also may also have different alignment relative to the canvas. You can get the bounds of each layer. The Canvas size is the active documents with and height in the units currently set in Photoshop preferences. There are types of layer not all have pixels. You can get the document layers in and array the length of the array is the number of layers. You change the documents canvas size you don't pass a document a size documents do not change themselves. You need to improve your Photoshop knowledge.