webmproject / WebPShop

Photoshop plug-in for opening and saving WebP images
https://developers.google.com/speed/webp/docs/webpshop
Apache License 2.0
1.49k stars 127 forks source link

Webp smart-layer loses transparency after reopening #36

Closed HyperEpsilon closed 2 years ago

HyperEpsilon commented 3 years ago

I have discovered that if a webp is imported to a psd as a smart layer, then the psd is closed and reopened, that resizing the webp layer causes the transparency to disappear and be replaced by pixelated white blocks.

It is only the transparency that is affected, the rest of the detail remains perfectly clear.

before resizing after resizing

Rasterizing the layer prevents the white from showing up, however it loses all the benefits of being a smart layer in the first place.

Also, this only occurs in files which have been saved and reopened, just saving and continuing work has no effect.

Photoshop version: 22.1.0 Webp Plugin version: 0.3.3 (This also happened on 0.3.2)

y-guyon commented 3 years ago

Thank you for the report. I reproduced the issue:

  1. Create new 128*128px 50% transparent white image
  2. Save a Copy, WebP, quality 100, no metadata, default compression effort
  3. Close it
  4. Open As Smart Object the freshly saved .webp
  5. Save As .psd
  6. Close it
  7. Open it
  8. Rescale the Smart Layer with the Move tool ("Show Transform Controls" enabled)

It happens with WebP files but not with PNG files.

WebPShop's DoReadStart() is called when opening the .webp normally, and when resizing the Smart Object after opening the .psd. I used these two calls to compare but unfortunately I was not able to find the root cause:

One noteworthy fact: in DoReadStart(), format_record->layerData is set to at least 1 (instead of 0 for still images) to force formatSelectorReadLayer* selectors instead of formatSelectorRead*. Otherwise there were alpha issues. In this case of Smart Object loading, layerData=1 has no impact, and thus the Layer selectors are not called, leading to these same alpha issues.

I also found out that opening an animated WebP as a Smart Object does not work at all and wrote the fix for that separate issue. It should be included in the next commit.

y-guyon commented 3 years ago

This is the same issue: https://community.adobe.com/t5/photoshop/handling-linked-object-reloads-in-format-plugins/m-p/8507484

y-guyon commented 3 years ago

I also filed a bug report: https://feedback.photoshop.com/conversations/photoshop/doessupportformatlayers-makes-formatselectorreadcontinue-to-ignore-alpha-channel/60db35828ce1226dd4309e8c

HyperEpsilon commented 2 years ago

Any movement on this? I see on the bug report site that apparently the feedback site has been closed.

y-guyon commented 2 years ago

This post with the same issue on the "new" Adobe Support Community platform is still open, so I guess nothing changed besides the implicit termination of any official Adobe support.

y-guyon commented 2 years ago

Photoshop 23.2 has partial native WebP support. Uninstalling WebPShop removes this smart-layer resize issue (but encoding preview and animations will not be supported anymore).