简体   繁体   English

iPhone透明图像渲染不佳

[英]iPhone transparent images rendering poorly

I'm developing an iPad application. 我正在开发iPad应用程序。 I have been provided with a PNG image that contains some transparency - basically a drop shadow. 我提供了一个PNG图片,其中包含一些透明度-基本上是一个阴影。 The problem I'm having is that this is rendering poorly within the application, both on the device and in the sim. 我遇到的问题是,无论是在设备上还是在SIM卡中,这在应用程序中的渲染效果都很差。

I've made up some samples to illustrate. 我整理了一些示例来说明。 The first is how the image appears in the PSD (correctly that is). 首先是图像在PSD中的显示方式(正确的是)。 The second is how it appears on the device. 第二个是它在设备上的显示方式。 You can see that the strip of shadow in the middle of the image is distinctly more yellow and poorly looking. 您可以看到图像中间的阴影带明显更黄且外观较差。

PDF http://www.aspyre.com.au/stackoverflow/photoshop.png On Device http://www.aspyre.com.au/stackoverflow/device.png PDF http://www.aspyre.com.au/stackoverflow/photoshop.png 在设备上http://www.aspyre.com.au/stackoverflow/device.png

Any ideas what I'm doing wrong? 有什么想法我做错了吗?

Edit: Links to files: - PNG - PSD 编辑:链接到文件: -PNG - PSD

Edit 2: I've also tried pngcrush to remove the gamma, in case that was causing a problem, but no luck. 编辑2:我也尝试过pngcrush删除伽玛,以防造成问题,但没有运气。 Directions I followed were here: pngcrush 我遵循的方向在这里: pngcrush

The reason you're getting a colour in your shadow is because the PSD's shadow layer is set to Multiply and has a colour in it. 之所以会在阴影中产生颜色,是因为PSD的阴影层设置为“正片叠底”并具有颜色。 When you export it without a background, Photoshop is unable to multiply it to anything and just uses the layer as is. 在没有背景的情况下导出时,Photoshop无法将其乘以任意值,而仅按原样使用该图层。 You need to grab the selection of the shadow layer, create a new layer, and fill that selection with black. 您需要获取阴影层的选择,创建一个新层,然后用黑色填充该选择。 Then set that new layer's opacity to something that mimics the old shadow. 然后将新图层的不透明度设置为模仿旧阴影的颜色。

Also I recommend you use Save-For-Web if you don't already. 另外,我建议您使用Save-For-Web(如果尚未使用)。 The colour-profile you use isn't much of an issue then as it will be stripped. 您使用的颜色配置文件并不是什么大问题,因为它将被剥离。 However the point is valid that you want to be in sRGB when making iPhone/iPad graphics. 但是,在制作iPhone / iPad图形时,要成为sRGB是正确的。

Link to your PSD adjusted: PSD 链接到已调整的PSD: PSD

Common mistakes: 常见错误:

  1. Your color space is non-standard. 您的色彩空间是非标准的。 Either use no color space, or specify sRGB (strongly preferred). 不使用颜色空间,或指定sRGB(强烈推荐)。
  2. You didn't save the PNG with gamma information included. 您没有保存包含伽玛信息的PNG。

如果无法访问实际文件,我们将不知所措。也许您使用的是8位而不是24位png?

For your shadow, use black instead of gray. 对于阴影,请使用黑色而不是灰色。 Then adjust the transparency. 然后调整透明度。 That should fix it. 那应该解决它。

I had a similar issue that I resolved by disabling compression for an image. 我有一个类似的问题,可以通过禁用图像压缩来解决。 This is done in XCode by removing the .png extension. 这是在XCode中通过删除.png扩展名完成的。 You can disable png compression for an entire project by editing the 'Compress PNG Files' project setting, but it is not recommended. 您可以通过编辑“压缩PNG文件”项目设置来禁用整个项目的png压缩,但不建议这样做。

More details about Xcode PNG compression: http://iphonedevelopment.blogspot.com/2008/10/iphone-optimized-pngs.html 有关Xcode PNG压缩的更多详细信息: http : //iphonedevelopment.blogspot.com/2008/10/iphone-optimized-pngs.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM