Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PNG with transparency from Photoshop to Flash: how to make .swf display exactly what .psd does?

I have two layers in Photoshop: 1 -- a texture, 2 -- a semi-transparent image that overlaps texture. The combination of the two looks nice in Photoshop. I export them separately from Photoshop saving them as 24 bit PNG with transparency and colors converted to sRGB. (Working color space of PS is sRGB.)

The result of importing them into flash makes me cry (see images below, note what areas around crosses look like). :(

I tried both loading PNGs dynamically and directly importing them into fla (compression type: lossles, allow smoothing: false). Looks like semi-transparent areas are saved inacurately on export. What's more puzzling to me is why the results differ between dynamic loading and direct importing.

What am I missing? In-depth explanation of these symptoms would be highly appreciated.


EDIT1 Here is that psd I'm stuck upon. Inside the zip you'll find transparency.psd, which has only two layers. I still have no luck in placing them into fla: transparent areas get dirty.

http://noregret.org/test/transparency.zip (400 kb)


EDIT2 A fellow flash developer pointed me to "premultiplied alpha problem".

http://en.wikipedia.org/wiki/Alpha_compositing#Description

I think this must be the problem I'm trying to overcome.

As far as I know by now, Photoshop internally uses straight alpha (premultiplying with white on PNG export) and Flash uses premultiplied alpha. But I still don't get it: what yields the difference in rendering of transparent images? And I still don't know exactly what operations I need to perform to get things look the same in PS and Flash (or at least how do I instruct our artists on preparing the images).

Anyone? I'm continuing to dig Google for the answer.


EDIT3 Unfortunatelly, I can't flattern image. This example here is just a small part of a bigger picture. I have a rather complicated interface with a lot of semi-transparent elements on top of a texture. The picture looks cool (like it's made of crumpled cardboard or something). So, I need a texture and semi-transparent layout separately. Adding blendmodes to top layer in flash does solve "the ghosting areas" problem, but it also significantly changes the picture, which is not acceptable.


Semi-transparent layer:

enter image description here

Texture layer:

enter image description here

Results (screenshots of PS and Flash Player on Windows):

  • Photoshop(original): Ok
  • Flash (import to fla): heavy ghost area
  • Flash (png loading): light ghost area

enter image description here

like image 805
Michael Antipin Avatar asked Nov 05 '22 18:11

Michael Antipin


1 Answers

It looks like you are getting JPEG image format with compression inside your FLA, not PNG. And to avoid that, you need to specify that your image compression should be lossless. You can do that in library or in MovieClip props.

like image 111
taokakao Avatar answered Nov 15 '22 08:11

taokakao