adobe-photoshop / generator-core

Core Node.js library for Adobe Photoshop CC's Generator extensibility layer
MIT License
692 stars 97 forks source link

Placed JPG smartObject can't generate retina. #395

Open zimag opened 7 years ago

zimag commented 7 years ago

If I just drag and drop a .jpg to the doc ( becoming a smartObject ) and trying to generate high res assets from it, seems like the resolution is still 72dpi.

image

If I open the .jpg first, select all pixels, copy-paste them into the original doc, and make a smartObject from it, the asset generating perfectly.

The obvious difference between the 2 smartObjects is that the .jpg one has a background layer.

Cannot_Generate_Retina_300x250_GEMIUS.zip

canoztokmak commented 7 years ago

jpg is not a vector format.. so you cannot expect it to be retina even after you convert it to smart object..

zimag commented 7 years ago

Sorry if I wasn't clear enough:

The smartObject has the resolution, much more than necessary. The placed .jpg is converted to smartObject and scaled down to accomodate it's small place in the layout.

After that, if I generate a .png file, or getting a 2x resolution pixmap from this smartObject, the result isn't retina as we can see on the screenshot above. The pixels from the preview information are scaled up to the desired resolution, not the real pixel content.

If I convert the content of the smartObject to a transparent layer ( not Background ) the bug is disappearing.

timothynoel commented 7 years ago

For the time being, only psd smart objects can be re-rendered as part of assert generation, and therefore take advantage of the original resolution in the underlying file. A JPEG smartobject is scaled from the existing layer data (so it's limited to what's in the layer data), a psd smart object, which is what you get with the copy/paste is re-opened/rendered so it can scale from the original pixels. This has to do with some limitations in background processing. The upshot is, if you want max resolution in your smart objects w/your assets, use PSDs.