Photoshop: Add an option for Generate Image to export images at document size instead of layer pixel size

  • 1
  • Idea
  • Updated 2 weeks ago
  • (Edited)
Hi!

Generate Images in Photoshop is a feature that I have been utilizing to automate mass saving of 24b pngs quickly through linked layers, and i love it - however would like to request a feature that would allow Generate Images to save the file based on the document size as opposed to the pixels of the layers.

My content expectation is that i need to save a large quantity of images at a consistent size (document size) quickly. I have written a script that will assemble a psd of linked layers for our artists to output mass-quantities of images at multiple sizes for use in our game. The images that are output are used in a modular UI system that requires all images to be the same exact size, but the renders going into the psd do not have the same pixel dimensions.

Generate Images is nice because it runs in the background, without a need to run a different script. I could write another script that batches everything, but I would love to keep the process as few steps as possible. 

I need to hack in a layer in the script called "pixels" that places a pixel in the top left, and bottom right at 10% flow for Generate Images to save a file out at the size of the DOCUMENT, instead of the pixels in the layers.

The issue i frequently run into is the rgb pixel stretching that happens in the RGB layer sometimes picks those white pixels to stretch instead of the main pixels of the image, causing halos on my content. I frequently have to disable Generate Images, turn off my pixels layer, and save manually - like some kind of caveman! :)

If there could be an argument that would allow for generate images to save the contents of the group to the document size instead of pixels of the layers, it would save me a hacky step, and root out errors down the pipe!
Photo of Maury Mountain

Maury Mountain

  • 4 Posts
  • 3 Reply Likes

Posted 3 weeks ago

  • 1
Photo of Max Johnson

Max Johnson, Champion

  • 460 Posts
  • 212 Reply Likes
I use the Asset Generator in our workflow too and use layer masks to define un-trimmed export crops all the time.

If you have a pixel or vector mask on any layer or group with the ".png" or ".jpg" flag on the end, it will crop the export to the mask, regardless of transparency on the layer or group.

If you make a script or action to select-all and make layer mask on your export layers, you get a full-canvas (or artboard) export.
Photo of Max Johnson

Max Johnson, Champion

  • 460 Posts
  • 212 Reply Likes
I've also used this trick to export different aspect ratio crops by grouping masked export groups inside eachother.
Photo of Maury Mountain

Maury Mountain

  • 4 Posts
  • 3 Reply Likes
awesome! great idea, thanks! 
Photo of Sam Gannaway

Sam Gannaway, Employee

  • 14 Posts
  • 11 Reply Likes
Another option to the mask method, is to use Artboards.  An Artboard will export at it's set dimension, which could be set to match the document.  
Since you are using a script to create the psd of linked layers, perhaps you can add a step to create Artboards (or masks) for the output.

Feel free to post back here or contact me directly if you have any questions.

Sam
Photo of Maury Mountain

Maury Mountain

  • 4 Posts
  • 3 Reply Likes
ahh interesting! Didn't think to use a mask or art boards, thanks! Easy to add either of those to the script!

using an art board would also free up how im grabbing file names to name the groups in the script, and allow artists to name the PSD a bit cleaner for our content organization and allow the art board to use a simpler name to build the final asset names.

great stuff, thanks for the replies!


(Edited)
Photo of Maury Mountain

Maury Mountain

  • 4 Posts
  • 3 Reply Likes
Got some time to try some stuff out, and wanted to share results.

Ended up using the mask on group method and got it hooked into the script. 

Art Board on its own option was not saving the file properly.  The Artboard was set to the document size, generate image group within the art board, and the file saved based on the pixels of the layer instead of the artboard/document size. 

Thanks again for the replies and options, this helps a ton!

(Edited)
Photo of Max Johnson

Max Johnson, Champion

  • 457 Posts
  • 212 Reply Likes
Makes sense, since the generator will trim transparent pixels by default unless there's a mask on the exporting layer/group. If you put a mask on the artboard that fit the artboard dimensions, I bet you get the correct size.
Photo of Sam Gannaway

Sam Gannaway, Employee

  • 14 Posts
  • 10 Reply Likes
You wrote "generate image group within the art board".  Does that mean you had a group inside the artboard named something like "output.png"?  If that's the case, then you would need to rename the artboard to "output.png" and rename the group to not have it generate.  An artboard named to generate will do so at it's dimensions.  An artboard is more or less a fancily masked group.