This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Friday, March 7, 2008 8:15:52 AM(UTC)
Groups: Registered
Posts: 2
I am trying to acheive a watermark effect on images using a TIFF that has ALPHA data in it. I have it working fine, looks great using the featherAlphaBlend command method. However my client also needs a version where the watermark is tiled across the entire image. Certain functions(underlay being an example) offer a tile option, I don't seem to see this with the FeatherAlphaBlend. For now I have code written that calcualtes the tile and applies the featherAlphaBlend to each location with watermark cropping as needed etc.
Is there a way to acheive the same effect using just one call to the leadtools function? As always I am looking towards the most effeicient algorythm here. Thanks.
#2
Posted
:
Monday, March 10, 2008 2:21:30 AM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
This
depends on nature of the watermark.
If the
background is a simple one-color image, and the alpha mask determines the shape
of the watermark, instead of calling the Feather Alpha Blend function
repeatedly, you can create a mask image that contains tiled transparency
stamps, and perform alpha feathering only once.
If the
background image is not mono-color and also contains a shape that needs to be
repeated, the best approach also depends on other factors. If you are going to
apply the same pattern to a large number of images, it is worth creating a
tiled background (and tiled mask) once and using them with different images.
However,
if you must tile different background and also tile different alpha masks for
different images, you current approach might be the best.
To
create a tiled background and tiled alpha mask, you can use the CombineCommand
class.
#3
Posted
:
Monday, March 10, 2008 4:02:55 AM(UTC)
Groups: Registered
Posts: 2
Thanks for the reply. The issue is that the images I have to watermark can be any size, we have millions of them in the repository. Also my app has to handle the fact that our client sends us the watermark .tiff file, it is not created by us so there is no way to predetermine size for a tile mask or modify the file. Can I generate the tiled mask and use that with the FeatherAlphaBlend, resulting in one call to the function? If so do I get a performance gain fom this. Granted you don't have my code for calculating the tile dynamically but it is as effiecient I can see possible. The issue I guess would be in possible overhead within the featherAlphaBlend function that occurs once per call rather than during the actual application of the blend. Does that make sense and do you know the answer to this? Thanks again
#4
Posted
:
Tuesday, March 11, 2008 1:15:40 AM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
You will
need to determine if there's any gain depending on your actual images, but here
are some guidelines:
1.
Creating multiple tiles of the mask image or the watermark image requires
multiple calls to the CombineFastCommand class.
2. A
single call to FeatherAlphaBlend takes more time than a single call to CombineFast.
3.
Multiple calls to FeatherAlphaBlend could take significantly more time than multiple
calls to CombineFast.
4.
However, there is added processing when you have to call CombineFast repeatedly
on two images (mask and watermark).
If
you're going to process millions of images and your current approach is already
working, it might be worth taking the time to create a second approach and test
both before you continue doing the rest of them.
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.