Open GDreyV opened 8 years ago
There's a maxDimensions parameter that defaults to 10000. https://github.com/adobe-photoshop/generator-core/blob/master/lib/generator.js#L957
You can set that value to as large as you want, however images are really large sizes will crash generator / node as it runs out of memory. You can see in generate assets how the max dimensions are calculated to safely get large images near the limit we found on each platform. https://github.com/adobe-photoshop/generator-assets/blob/master/lib/renderer.js#L265
Hope that helps.
Tossing out a few things that might be related. Fill layers don't really have bounds, unless they are masked, they just "fill up the available space", so the bounds reported are usually the bound of the maximum associated element with bounds (doc bounds, or if you're getting non-doc-clipped thumb, the doc bounds + bounds of any other layers included in the thumbnail). The underlying Photoshop API used by Generator.prototype.getPixmap, sendLayerThumbnailToNetworkClient, has some additional tweaky params that might help: includeAncestors:includeAll will clip/mask the layer according to its containers (groups/artboards). I think that's called includeAncestorMasks in getPixMap. sendLayerThumbnailToNetworkClient also has a parameter, "clipBounds" (works like clipToDocumentBounds but lets you specify a rect), which doesn't seem to be exposed in getPixmap. I think "maxDimensions" will scale things down to fit into those dimensions, which would work for a color fill, but maybe not what you want for other layer types. Take a look at sendLayerThumbnailToNetworkClient on the API wiki page https://github.com/adobe-photoshop/generator-core/wiki/Photoshop-Kevlar-API-Additions-for-Generator for more info.
Thanks for fast reply! I believe "clipBounds" is what i'm looking for. But not sure how can I use it. Should I write own wrapper for provided sendLayerThumbnailToNetworkClient implementation? Or it's part of library which I just need to reuse?
I think you'll have to write another wrapper, or add the param to getPixmap as a pull request that might work. Or perhaps add a general way of passing new/custom params into getPixmap, to allow for quicker experiments. I don't know what if anything we give up there in terms of performance or robustness if we leave it open-ended like that (you wouldn't be able to flag bad params as easily) Maybe @chrisbank or @iwehrman has an opinion there.
Maybe I'm doing something wrong but I'm getting following error running script: General Photoshop error occurred. This functionality may not be available in this version of Photoshop. My version is Adobe Photoshop Version: 2015.1 20151114.r.301 2015/11/14:23:59:59 CL 1053036 x64
Hello, I have 2 artboards: "artboardRect": { "top": 0, "left": 0, "bottom": 1334, "right": 750 } "artboardRect": { "top": 1476, "left": 750, "bottom": 2810, "right": 1500 } I create solid fill adjustment layer in second artboard. I suppose that it must have bounds equal to artboard's bounds. But really bounds are: "bounds": { "top": 0, "left": 0, "bottom": 3382, "right": 2250 }. The problem becomes serious when we have many artboards and try to generate layers preview. We are getting bitmaps which are e.g. 10000x10000px. I use clipToDocumentBounds but it doesn't make any sense. Not sure if it's generator issue but maybe you have ideas how to resolve it? Sample I used