将图像转换为 iPhone 工具栏图标

发布于 2024-09-24 00:09:08 字数 846 浏览 7 评论 0原文

我有一个灰度图标,正在使用 Photoshop 进行编辑,背景透明,但我怎么也想不出如何将该图标转换为可用作 iPhone 工具栏图标的图标。如果我只是将图像保存为 PNG,它不会在 iPhone 上显示为抗锯齿,因为每个有颜色的像素都被渲染为黑色,而不是灰色阴影。

根据 Apple 文档和其他来源,图像上需要有一个 Alpha 通道来指定每个像素的不同透明度级别。但是,我不知道这意味着什么。我已经阅读了 Adob​​e 的这些帖子和文档,但仍然不知道如何正确地将灰度图像转换为可用作 iPhone 工具栏图标的图像。这篇博客文章很难理解,而且写得不好,而且 Adob​​e 文档也没有真正的帮助。

http://cahit.hayalet.net /blog/514/converting-an-image-to-iphone-toolbar-icon/

http://livedocs.adobe.com/en_US/Photoshop/10.0/help.html?content=WS74B356C9-353F-4483-8632-7B1A102F2A2E .html

有人可以为我指明正确的方向,或者提供在 Photoshop 中执行此操作的准确的分步说明吗?

I have a grayscale icon that I'm editing with Photoshop with a transparent background, but I can't, for the life of me, figure out how to convert the icon to one that can be used as an iPhone toolbar icon. If I simply save the image as a PNG, it doesn't show up as anti-aliased on the iPhone because every pixel with color is being rendered as black, instead of a shade of gray.

According to the Apple docs and other sources, there needs to be an alpha channel on the image to specify varying levels of transparency for each pixel. However, I have no idea what that means. I've read these posts and docs from Adobe and I still can't figure out how to properly convert a grayscale image into one that can be used as an iPhone toolbar icon. The blog post is hard to comprehend and poorly written, and the Adobe docs don't really help.

http://cahit.hayalet.net/blog/514/converting-an-image-to-iphone-toolbar-icon/

http://livedocs.adobe.com/en_US/Photoshop/10.0/help.html?content=WS74B356C9-353F-4483-8632-7B1A102F2A2E.html

Can someone point me in the right direction or provide exact, step-by-step directions to doing this in Photoshop?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

心安伴我暖 2024-10-01 00:09:08

这比在 Photoshop 中使用实际的蒙版要简单得多。

iPhone 工具栏图标约为 30 像素 x 30 像素,因此请使用这些尺寸创建一个新的 Photoshop 文件。确保背景是透明的(您可以在创建新文件时指定)。

然后,您在此透明度之上绘制的任何像素都会成为 iOS 用于图标的像素。无论 NSToolbar 图标在 Photoshop 中的颜色是什么,iOS 都会自动将它们用作遮罩。

将要显示的部分保持透明。另存为 24 位 PNG,然后像往常一样插入 XCode。

对于一些可以作为良好起始示例的图标,请查看我在此处免费发布的图标:http://glyphish.com 只需选取其中一个 PNG 并在 Photoshop 中打开它,您就会看到它以任意颜色 (#444444) 绘制,具有不同的不透明度级别,以创建图标的较暗和较亮部分。

It's much more simple than having to muck with actual masks in Photoshop.

iPhone toolbar icons are about 30px by 30px, so make a new Photoshop file with those dimensions. Ensure the background is transparent (you can specify that when creating a new file).

Then, any pixels you draw on top of this transparency become what iOS uses for the icon. Doesn't matter what color it is in Photoshop for NSToolbar icons -- they're automatically used as masks by iOS.

Leave transparent the parts you want to show through. Save as 24-bit PNG, and chuck into XCode as usual.

For a few icons that serve as good starting examples, check out the ones I publish for free here: http://glyphish.com Just take one of the PNGs and open it in Photoshop and you'll see that it's drawn in an arbitrary color (#444444) with varying levels of opacity to create darker and lighter parts of the icon.

他夏了夏天 2024-10-01 00:09:08

这更像是一个 Photoshop 问题,而不是编码问题,但无论如何,这里有一个建议。

Lunacore 有一个很好的教程,介绍如何使用蒙版。

你想要做的是:

  1. 确保你的背景是透明的。
  2. 创建一个新层并
    用任何纯色填充它。
  3. 在纯色上创建蒙版
    图层,并将灰度图像填充到蒙版中。 (使用你的
    灰度图像作为蒙版。)

工具栏图标使用您的图像作为蒙版。他们只考虑图像的透明度。不是什么颜色或阴影。

This is more of a photoshop question than coding but anyway, here's a suggestion.

Lunacore has a good tutorial on how to use masks.

What you want to do is:

  1. Make sure you're background is transparent.
  2. Create a new layer and
    fill it with any solid color.
  3. Create a mask on the solid color
    layer, and fill your greyscale image into the mask. (Use your
    greyscale image as the mask.)

Toolbar icons use your image as a mask. They only consider what transparancy the image has. Not what color or shade.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文