Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using CATiledLayer, thin line between Tiles on rendering, tiles generated with ImageMagick

Using the PhotoScroller example by Apple and ImageMagick I managed to build my catalog app.

But I'm having a rendering bug. The tiled images are rendered with a thin line between them.

My simple script using ImageMagick is this:

#!/bin/sh

file_list=`ls | grep JPG`

for i in 100 50 25; do 
 for file in $file_list; do
  convert $file -scale ${i}%x -crop 256x256 -set filename:tile "%[fx:page.x/256]_%[fx:page.y/256]" +repage +adjoin "${file%.*}_${i}_%[filename:tile].${file#*.}"
 done
done

The code from Apple is the same. The bizarre thing is that the images that they provida already tiled works like a charm, in the same run time, side-by-side with my images :(

My first guess was that the size of the tiles was not matching with the calculations on code, but change sizes didn't fix, neither on my script or in the code. My images are usually smaller than those provided by apple, half the size actually.

Anyone got the same issue?

like image 984
Douglas Schmidt Avatar asked Nov 19 '10 17:11

Douglas Schmidt


1 Answers

I had problems with both solutions. Damien's approach did not fully eliminate all lines at all zoom scales and Brent's solution removed the lines, but added some artifacts at tile borders.

After googling around for some while, I finally found a solution that worked nicely for me: http://openradar.appspot.com/8503490 (comment by zephyr.renner).

After all, Apple's assumption that CTM.a == CTM.d doesn't seem to be "safe" at all...

like image 127
Daniel Rinser Avatar answered Jan 31 '23 17:01

Daniel Rinser