You are here

tile management

Hello,
I want to understand how tile's work, and i found an example and a don't understand completely:( and i have 2 questions .
1. Can anyone tell me why in gimp_tile_cache_ntiles (2 * (drawable->width / gimp_tile_width () + 1)), it is adding +1, i understand what are drawable->width and gimp_tile_width, and why is multiplying with 2, but i don't know why in +1?
2. if i want to process an image with tile's, the pixel's that are on the border, they are process? if i have for example to process a pixel with his 8 neighbors, what happed with the pixel's from margins ?

Please can you help me, i have a test paper on school and i want to present something new
Thank you very much :)

Miky

Forums: 

1. The drawable might not start at the left edge of the first tile. Note how the drawable in the following example is only three tiles wide yet it requires four tiles when stored in memory. (Tiles are aligned to a grid relative to the image's origin.)

2. Your filter should be working on copies of the tiles. It should process the entirety of all tiles. When the processed tiles get put back into the original drawable, the outlying regions (the white areas in the above example) will be ignored (they are outside the drawable's dimensions).

3.* If there is a selection present, you should still process the entirety of all tiles; and when your processed tiles are merged back with their corresponding source tiles, the selection will be used as a blending mask between the original and your modified versions.

* You didn't specify a "3.", but it would probably prove beneficial to consider "2." as a specific case of the more general situation presented in "3."

In your example, if the first pixel (I'll tell it A) of the first drawable tile(first red pixel up left), need the value of the first pixel (B) in tile 1(white pixel up left) for processing? pixel A will be modify, or will stay with the same value in the end?
Let's say that the current pixel will be process adding it's left pixel(A=A+B), pixel A will be process in this case?

Thank you,
Miky

Pixel A will be modified -- even though the value of pixel B may not be known.

Occasionally, this will cause problems and some filters will need to guess at what the contents of pixel B should be. I believe that by default, pixel B will be black (color RGB=0,0,0) and this might not produce a good result. Some filters work better if pixel B has the same value as pixel A ("smear"), while others might use a copy of the first pixel in the fourth tile for pixel B ("wrap").

In some cases the filters might be able to adjust their algorithms such that pixel B is never considered (I believe gaussian blur does this); but this is not always possible and does not necessarily produce a more desirable result.

There is no guess which will work for all situations.

Thank you very much :)

Subscribe to Comments for "tile management"