Skip to main content
Known Participant
February 19, 2024
Answered

Generate image assets from layers losing, Color Profiles

  • February 19, 2024
  • 3 replies
  • 1416 views

Hello!
I am used to work with generating asset from layers through naming my artboards, as suggested in this link.
https://helpx.adobe.com/photoshop/using/generate-assets-layers.html

But recently I noticed that when I do use this feature, images are generated correctly… a part for their color profiles which are lost during the process. For example: sRGB becomes a random RGB

Is their any way to keep colorprofiles of the initial file when assets are generated ?
Thank you!

Correct answer Stephen Marsh

@Ernesto TK 

 

As the configuration file is a plain text JSON formatted .js file, you could manually update it instead of using the Generator Config panel.

 

EDIT: here is a copy of the default generator.js file created in the current user's ~/ home directory using the extension:

 

module.exports = {
    "generator-assets": {
        "svg-enabled": true,
        "svgomg-enabled": true,
        "css-enabled": false,
        "use-smart-scaling": false,
        "include-ancestor-masks": false,
        "allow-dither": false,
        "use-psd-smart-object-pixel-scaling": false,
        "use-pngquant": true,
        "convert-color-space": false,
        "use-flite": true,
        "embed-icc-profile": false,
        "clip-all-images-to-document-bounds": true,
        "clip-all-images-to-artboard-bounds": true,
        "mask-adds-padding": true,
        "expand-max-dimensions": false,
        "webp-enabled": false,
        "interpolation-type": "bicubicAutomatic"
    }
}

 

Simply change the boolean value from false to true:

 

"embed-icc-profile": true,

 

Restart Photoshop and your Generator JPEG files should now include the ICC profile of the source document.

 

P.S. Here is a copy with all options on and the three dropdown menus set from the defaults:

 

module.exports = {
    "generator-assets": {
        "svg-enabled": true,
        "svgomg-enabled": true,
        "css-enabled": true,
        "use-smart-scaling": true,
        "include-ancestor-masks": true,
        "allow-dither": true,
        "use-psd-smart-object-pixel-scaling": true,
        "use-pngquant": true,
        "convert-color-space": true,
        "use-flite": true,
        "embed-icc-profile": true,
        "clip-all-images-to-document-bounds": true,
        "clip-all-images-to-artboard-bounds": true,
        "mask-adds-padding": true,
        "expand-max-dimensions": true,
        "webp-enabled": true,
        "interpolation-type": "bicubic",
        "icc-profile": "sRGB IEC61966-2.1",
        "use-jpg-encoding": "optimal"
    }
}

 

 

EDIT: Another option to create the generator.js configuration file:

 

https://community.adobe.com/t5/photoshop-ecosystem-discussions/online-quot-generator-quot-config-file-creator-available/m-p/14971604

3 replies

D Fosse
Community Expert
Community Expert
February 20, 2024

Generator uses Quick Export, which for some reason has no way to embed the profile. That renders it useless to me.

Stephen Marsh
Community Expert
Community Expert
February 20, 2024

@D Fosse 

 

You can now take another look at Generator!

D Fosse
Community Expert
Community Expert
February 20, 2024

Indeed I can! Your scripts, over time, have amended a lot of the shortcomings in Photoshop - but I think this one in particular should have been fixed at the factory. This is basic functionality that should just be there.

 

So my post was just pointing out why the profile isn't embedded to begin with.

Stephen Marsh
Community Expert
Stephen MarshCommunity ExpertCorrect answer
Community Expert
February 20, 2024

@Ernesto TK 

 

As the configuration file is a plain text JSON formatted .js file, you could manually update it instead of using the Generator Config panel.

 

EDIT: here is a copy of the default generator.js file created in the current user's ~/ home directory using the extension:

 

module.exports = {
    "generator-assets": {
        "svg-enabled": true,
        "svgomg-enabled": true,
        "css-enabled": false,
        "use-smart-scaling": false,
        "include-ancestor-masks": false,
        "allow-dither": false,
        "use-psd-smart-object-pixel-scaling": false,
        "use-pngquant": true,
        "convert-color-space": false,
        "use-flite": true,
        "embed-icc-profile": false,
        "clip-all-images-to-document-bounds": true,
        "clip-all-images-to-artboard-bounds": true,
        "mask-adds-padding": true,
        "expand-max-dimensions": false,
        "webp-enabled": false,
        "interpolation-type": "bicubicAutomatic"
    }
}

 

Simply change the boolean value from false to true:

 

"embed-icc-profile": true,

 

Restart Photoshop and your Generator JPEG files should now include the ICC profile of the source document.

 

P.S. Here is a copy with all options on and the three dropdown menus set from the defaults:

 

module.exports = {
    "generator-assets": {
        "svg-enabled": true,
        "svgomg-enabled": true,
        "css-enabled": true,
        "use-smart-scaling": true,
        "include-ancestor-masks": true,
        "allow-dither": true,
        "use-psd-smart-object-pixel-scaling": true,
        "use-pngquant": true,
        "convert-color-space": true,
        "use-flite": true,
        "embed-icc-profile": true,
        "clip-all-images-to-document-bounds": true,
        "clip-all-images-to-artboard-bounds": true,
        "mask-adds-padding": true,
        "expand-max-dimensions": true,
        "webp-enabled": true,
        "interpolation-type": "bicubic",
        "icc-profile": "sRGB IEC61966-2.1",
        "use-jpg-encoding": "optimal"
    }
}

 

 

EDIT: Another option to create the generator.js configuration file:

 

https://community.adobe.com/t5/photoshop-ecosystem-discussions/online-quot-generator-quot-config-file-creator-available/m-p/14971604

Known Participant
February 20, 2024

Thank you for your answer! I will try!
Where can I find this file ? (I am in a Mac ecosystem) 
In the application support folder or any hidden preferences folder ? 

Edit: Should I create a text file, copy/paste the code lines and save them as a generator.js in my "home" folder?


Stephen Marsh
Community Expert
Community Expert
February 20, 2024
quote

Edit: Should I create a text file, copy/paste the code lines and save them as a generator.js in my "home" folder?



By @Ernesto TK


Yes!

Known Participant
February 20, 2024

I found this:
https://github.com/adobe-photoshop/generator-assets

But It doesn't work with last Mac M1 builds, is there any alternative for M1 macs ?