iphone tiling an image

梦想的初衷 提交于 2019-11-30 05:57:04
Peter

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?

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.

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

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.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!