iphone 平铺图像

发布于 2024-09-09 21:38:17 字数 162 浏览 5 评论 0原文

我有一个 1280 x 1664 的图像,我想使用 Apple 提供的 ScrollViewSuite 示例,但我需要将此图像剪切到多个缩放级别。

那么,有人知道如何在多个缩放级别上平铺图像吗?一定有一种简单的方法可以将图像填充到 256x256,而无需通过 Photoshop 手动切割它吗?

I have an image which is 1280 x 1664 and I want to use the ScrollViewSuite example that Apple gives us but I need to cut this image up to multiple zoom levels.

So, does anybody know how I can tile an image at multiple zoom levels. There must be an easy way to tilling an image to 256x256 without cutting it by hand via photoshop?

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

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

发布评论

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

评论(4

記柔刀 2024-09-16 21:38:17

很棒的发现。我根据您发现的内容做了一些研究,并设法将行和列添加到输出文件名中。我还将图像大小调整为我想要的图像百分比。所以我现在可以通过一张大图像来完成这一切。

convert bigimage.png -resize 25% -crop 256x256 -set filename:tile "%[fx:page.x/256+1]_%[fx:page.y/256+1]" +repage +adjoin "tile_25_%[filename:tile].png"

非常感谢您对我的帮助,它节省了我很多时间。希望我帮到你了?

great find. I did a bit of researching from what you found and I've managed to add the row and col to the output filename. I've also resized the image to what percentage I want the image to be. So I can now do it all from 1 large image.

convert bigimage.png -resize 25% -crop 256x256 -set filename:tile "%[fx:page.x/256+1]_%[fx:page.y/256+1]" +repage +adjoin "tile_25_%[filename:tile].png"

Thanks a lot for helping me out, its saved me a lot of time. Hopefully I've helped you out?

尛丟丟 2024-09-16 21:38:17

有趣的是——我昨晚上床睡觉时知道这是我今天早上必须解决的第一件事。我刚刚找到了一个非常简单的解决方案。 ImageMagick 开箱即用,使用带有 -crop 选项的转换:

convert bigimage.png -crop 256x256tile.png

这会根据需要生成尽可能多的图块文件,最重要的是在右侧和底部创建矩形。我探索的所有其他解决方案都从图像中制作了 n,m 个大小均匀的图块。

这些图块的编号为tile-##.png,其中## 从零开始。我更喜欢 -row#-col#.png,但这对我有用。 CATiledLayer,我来了。

Funny -- I went to bed last night knowing this was the first thing I'd have to address this morning. I just found a remarkably simple solution to this. ImageMagick out of the box using convert with the -crop option:

convert bigimage.png -crop 256x256 tile.png

This makes as many tile files as necessary and most importantly creates rectangles on the right side and bottom.. all of the other solutions I explored made n,m evenly sized tiles out of the image.

The tiles are numbered tile-##.png where ## starts at zero. I'd have preferred -row#-col#.png, but this will work for me. CATiledLayer, here I come.

迎风吟唱 2024-09-16 21:38:17

Jeff LaMarche 对此推出了自己的解决方案:

http: //iphonedevelopment.blogspot.com/2010/10/cutting-large-images-into-tiles-for.html

OS X App Store 上还有一个名为 Tilen 的应用程序:

http://itunes.apple.com/jp/app/tilen/id409199185?mt=12

Jeff LaMarche rolled his own solution to this:

http://iphonedevelopment.blogspot.com/2010/10/cutting-large-images-into-tiles-for.html

There is also an app called Tilen available on the OS X App Store:

http://itunes.apple.com/jp/app/tilen/id409199185?mt=12

白龙吟 2024-09-16 21:38:17

您还可以使用 gdal2Tiles 实用程序 - 它对于从大型输入图像生成地图叠加图块特别有效。

在 StackOverflow 上搜索“gdal2tiles”,并且一定要查看 Apple 的 TileMap 示例代码。 TileMap 可通过 WWDC 2010(免费)下载示例获得。

You can also use the gdal2Tiles utility - which is particularly effective for generating map overlay tiles from a large input image.

Search for "gdal2tiles" here on StackOverflow, and also be sure to check out the Apple's TileMap sample code. TileMap is available via the WWDC 2010 (free) download of samples.

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