iphone tiling an image

前端 未结 4 1247
夕颜
夕颜 2020-12-29 16:50

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, d

4条回答
  •  清酒与你
    2020-12-29 17:26

    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.

提交回复
热议问题