不常见的png文件iOS显示

时间:2012-07-23 13:03:13

标签: ios png retina-display image-conversion

this post中,我想知道为什么我的png文件在视网膜显示器上显示不正确。

我最终发现问题来自PNG文件本身:当我打开它并用photoshop或其他东西再次保存时,问题就会消失。

正如this post提议的那样,我使用sips命令查看我的PNG文件究竟是什么形成的。我有original-image.png(有毛刺)和photoshoped-image.png

命令

sips original-image.png -g all

给我

  pixelWidth: 256
  pixelHeight: 256
  typeIdentifier: public.png
  format: png
  formatOptions: default
  dpiWidth: 72.000
  dpiHeight: 72.000
  samplesPerPixel: 3
  bitsPerSample: 8
  hasAlpha: no
  space: RGB

sips photoshoped-image.png -g all

给我

  pixelWidth: 256
  pixelHeight: 256
  typeIdentifier: public.png
  format: png
  formatOptions: default
  dpiWidth: 72.000
  dpiHeight: 72.000
  samplesPerPixel: 4
  bitsPerSample: 8
  hasAlpha: yes
  space: RGB
  profile: HD 709-A

所以3个不同之处:

  • samplePerPixel
  • hasAlpha
  • photoshoped文件有个人资料。

但是这些特性是傻瓜只读的,我想知道如何更改它们以准确理解bug的来源。

有什么想法吗?

2 个答案:

答案 0 :(得分:1)

因此,使用sips可以输出不同的文件。获取photoshop文件并开始修改它。首先删除配置文件,然后删除alpa通道(这将影响前两个变量)。

很有可能这个图像有效。 PNG有许多选项,原始图像可能具有使用这些工具不可见的其他功能。 Photoshop显然是完全重写图像,使用RGB值作为文件之间唯一的共同属性。

我怀疑当你执行上述操作时,该图像也会起作用。原件上有一些奇怪的东西。

在任何情况下,如果您使用带有Alpha通道的png,您可以在iOS上更轻松,因为如果基本图像没有,可以将它们转换为一个。

答案 1 :(得分:0)

在某些文件中,这有效:

sips -s format png'/ Volumes / HD / Optimized PNG / TXT - Section Depth copy.png' - out'/ Volumes / HD / Optimized PNG / TXT - Section Depth copy-.PNG' / Volumes / HD / Optimized PNG / TXT - Section Depth copy.png   / Volumes / HD / Optimized PNG / TXT - Section Depth copy-.PNG mis-bhayward61p-swk:~zav $

但是,有时也不会:

sips -s format png --setProperty hasAlpha 0'/ Volumes / HD / Optimized PNG / Subsection copy 2 / Section Depth Text.png'-out'/ Volumes / HD / Optimized PNG / Subsection copy 2 / Section Depth文本.PNG” / Volumes / HD / Optimized PNG / Subsection copy 2 / Section Depth Text.png 错误:无法在文件中执行--setProperty hasAlpha   / Volumes / HD / Optimized PNG / Subsection copy 2 / Section Depth Text-.PNG mis-bhayward61p-swk:~zav $

希望这会让你更远一点。

相关问题