Jump to content
WnSoft Forums

Recommended Posts

Posted

Aliased masks and invisible colors

Solution

Sometimes you observed aliased edges of an mask image:

post-1-1175172355_thumb.jpg

The major reason of this problem - color of pixels in invisible part of an mask where alpha channel is 0%.

In this case main color of mask is black (RGB: 0,0,0), but colors of invisible pixels is white (RGB: 255, 255, 255):

post-1-1175172482_thumb.jpg

Bilinear algorithm requires that pixels in invisible part of an image should be same as in visible. The only difference will be in alpha channel - 0 for invisible pixels and 255 for visible pixels. When you make PNG image with text on transparent background, Photoshop set all pixels to color of text (green for example), but pixels of text has alpha 255 and pixels of transparent background - 0%.

Now we will open wrong mask in PixBuilder, choose invisible pixels in this mask using Magic Wand. Open main menu | Colors | Fill, choose Custom color and set R = 0, G = 0, B = 0, A = 0

Save PNG with mask. Now as you see no aliasing on edges:

post-1-1175172954_thumb.jpg

post-1-1175172981_thumb.jpg

And finally you can make edges of a mask smooth if apply blur filter in Photoshop/PixBuilder or turn on "Blur" option for mask object in PicturesToExe.

Here right PNG mask image I've corrected:

http://www.wnsoft.com/test/Right_Mask.png

P.S. Why this problem doesn't happen in Photoshop/PixBuilder when you compose similar scene with layers of a mask and images? These products use very slow algorithm of resampling which "knows" about this problem. But as you know resizing of 3000x2000 image may takes several seconds, but in slide show we have to use more fast algorithm (Bilinear) to provide 60 frames per second.

Posted

Can you explain why this black mask has a whiteish edge in P2E?

post-2938-1175189725_thumb.png

It was made in Photoshop CS2 and saved as a PNG file. It reopens in Photoshop CS2 fine and shows no visible edge artifacts.

When opened in Irfanview, it does show something odd at the edge, but Irfanview does not display PNG files with transparancy correctly. So I'm not sure if there is anything wrong with this file.

You described a way to correct the problem with PixelBuilder. If the problem is with the alpha layer in Photoshop CS2, does anyone know how to correct it. I tried using the Magic Wand, but no success.

For this type of mask, I have found that saving it as a GIF file works fine in P2E. I'm just wondering why the PNG file shows an edge artifact in P2E.

Steve Newcomb

Tucson, AZ USA

Posted

Steve,

I don't know how to fix it in Photoshop, but PixBuilder allows you to make this correction to an image.

Dominique,

Sorry, I didn't fully understood earlier that it is same problem in both cases.

In this topic I described a solution for any mask.

Steve,

There is another simple solution that should help in case of your simple mask (black mask and angle is 0). In beta 9 you can set "Low quality of resizing" option and it fixes the problem because with this option there will be no smooth edges and no light pixels.

I'm afraid this problem will be in any current or future slide show programs, because it's a particularity of Bilinear resampling. Bilinear resampling in many many times faster than Bicubic resampling and even latest powerful 3D video cards can perform only Bilinear resampling. Because of this author of slide show should care about preparing of correct mask.

Posted

Igor,

It would seem Photoshop CS2 sets the transparent pixels to white (255,255,255) either

1) when creating transparent layers in the program or

2) (more likely) when saving as a PNG file.

If it is 1) then there should be a way to match the color of the transparent (alpha 0%) pixels to that of the visible ones to minimize it. Anyone know how to do this?

If it is 2), then probably no solution until Adobe gives more control in saving PNG files.

This must also be going on with text saved as PNG files, but is not nearly as noticeable because it is part of a gradient when the shadow effect is used in Photoshop and the eye is much better at seeing linear differences than curves and broken bits.

But there are also several work arounds to this "problem" in this thread.

Thanks,

Steve Newcomb

Tucson, AZ USA

Posted

Steve,

Photoshop and PixBuilder correctly set color of invisible pixels for the text in PNG. Otherwise we could observe problems with text loaded from PNG image (and games and multimedia programs).

By the way, GIF is not solution - exactly same problem as with PNG.

Posted
And finally you can make edges of a mask smooth if apply blur filter in Photoshop/PixBuilder or turn on "Blur" option for mask object in PicturesToExe.

Igor,

I tried both methods : apply blur filter in photoshop on the whole mask and I still have the same problem. :huh:

Could you please give more details on how you proceeded ?

I applied blur option in PTE and I didn't noticed any change... :blink:

I'm afraid this problem will be in any current or future slide show programs, because it's a particularity of Bilinear resampling.

I made the test in proshow and I didn't get the problem. :unsure:

But as we know, proshow is not a reference for the quality of its ouput. :D

Posted
Photoshop and PixBuilder correctly set color of invisible pixels for the text in PNG. Otherwise we could observe problems with text loaded from PNG image (and games and multimedia programs).

Then perhaps the problem is the way the rectangle tool (the one I used to make the masks) works in Photoshop. I'll try different tools.

By the way, GIF is not solution - exactly same problem as with PNG.

post-2938-1175221511_thumb.jpg

This GIF file was made from the same Photoshop CS2 file as the above PNG mask and it does not show any artifacts at the edges. So that makes me think it has to do with how Photoshop saves PNG files. I don't know if the text PNG files invisible pixels are set correctly or not, but the mask file was made almost exactly the same way, starting with a blank layer totally transparent and then using rectangle tool to draw two black rectangles.

Steve Newcomb

Tucson, AZ USA

Posted

Steve,

Sorry, but it's only coincidence. Just we convert transparent GIF to 32-bit image and always set invisible pixels to black and in case of your mask (main color - black) it works.

Posted
Dominique,

Please say me, did you try with modified mask PNG file I've attached?

I will prepare video lesson tomorrow.

Igor,

I don't know what I did yesterday but I tried again to apply blur in photoshop and now it works. B)

But I tried to apply blur directly in PTE on the unmodified mask and there is no change.

Posted

I think we've found an excellent solution for this problem today.

We'll apply a post-filter on loading of PNG/GIF images and automatically correct pixels in invisible areas. It will not slow down loading of slides because we'll do it on building of EXE file when we convert PNG/GIF to our own lossless format (as PNG).

Aleksey told me that he will try to write this complex algorithm and PTE will care about this question. And for you no need to worry about this problem anymore.

Dominique,

Today we researched this question and found that Photoshop performs such correction after resizing or Blur effect (as you noticed).

Posted

That's excellent news!

ThAnk you for taking such good care of us. :)

Do you plan to include this improvement in beta #9 ?

Anyway, good luck to Aleksey.

Posted
Photoshop and PixBuilder correctly set color of invisible pixels for the text in PNG. Otherwise we could observe problems with text loaded from PNG image (and games and multimedia programs).

This mask of text sample was made by Photoshop CS2 starting with a transparent blank background, color of text is black, anti-alias set to None.

post-2938-1175437913_thumb.png

I can see edge effects when placed against a black background in P2E.

So it seems this alpha channel pixel problem exists with text PNGs made by Photoshop CS2 as well.

Your solution of checking the Low Quality of Resizing will correct it when fully implemented, as well as your new solution if that ends up working.

Steve Newcomb

Tucson, AZ USA

P.S. It is nice you are working on these small improvements to P2E, but I think it would be more useful to fully concentrate on fixing whatever major problems remain and release a next to final beta and save these minor improvements to future releases such as 5.x. I appreciate all the hard work and close attention WnSoft pays to its software, but I don't understand why it hasn't released a beta with functions that existed in its previous releases enabled yet.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...