Image-Type for Screensaver

Kosh

Member
Joined
Jul 10, 2006
Messages
8
Programming Experience
Beginner
Hi all.

Ive developed some sort of screensaver for our company.
It just our 5 times our logo flying around on the screen.

The problem I run into now is the quality of the logo.
I have our logo in eps-format an converted it to png with a transparent background. But when the logo moves over a dark background, i can see a white edge around the logo about 2 pixelx thick.

I also tried to use gif, but the white edge is still there.

This is the main code I use:

VB.NET:
Private img1 As Image = My.Resources.Swk.auge_schoner
 
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
 
Dim g As Graphics = e.Graphics
g.DrawImage(img1, pos1.X, pos1.Y, img1.Width, img1.Height)
g.DrawImage(img1, pos2.X, pos2.Y, img1.Width, img1.Height)
g.DrawImage(img1, pos3.X, pos3.Y, img1.Width, img1.Height)
g.DrawImage(img1, pos4.X, pos4.Y, img1.Width, img1.Height)
g.DrawImage(img1, pos5.X, pos5.Y, img1.Width, img1.Height)
 
End Sub
 
I've only ever really encountered this problem when using an imagelist component, so if you are not using one then i am going to assume that something has happened in the conversion to a .png. The fact that it exhibits this behaviour only when moving over a dark background is a bit confusing also. To start i would try to re-create your Logo in a photo editor like PS save it as a .png and see what happens then.
 
I have edited the logo in Paint Shop Pro X, and saved it to png.
The problem seems to be the alpha-blending.
Is there any possibility to set the alpha-color in vb.net?

So I could use a unconverted png and set the transparent color programatically?
 
It is possible via the forms transparency key property, problem is if you set it to white then if you have any white in your logo or anywhere else then that will appear transparent too.
 
There are several classes/methods which allow you to change the transparency of bitmap data. But if you aren't going to have the transparency change dynamically, why not use the coding that's already been done in PSPX? It's a very powerful program and I use it myself.
Did you see the white border in PSPX?
There are several features in PSPX that allows you to alter the way transparency data is handled. There's also the Export command under the File menu which gives you full control of how the image is saved instead of just using the saveas command.
Play around with the export function.
If you still have a problem maybe you could post the logo (if OK with your company) and I'll have a look at it. I've used PSPX quite a bit lately.
 
I am familiar with PSPX but Im far away from being a Pro. ; )

The original eps file is 7 MB large. (283x217 px)
I need the logo as small as possible and with a size of 170x130 px.

This is what I've done:
I opened the eps in PSPX using the default settings.
I resized the picture to 170x130 with smart-sampling.
Then I set the transparent color to white.
(This is where PSPX must change the colors to 256)
After I've done that the white border appears.
 

Attachments

  • auge klein.zip
    1.1 MB · Views: 27
HA! Ive got it.

I exported the picture in PSPX to gif and used 50% Dithering.
This worked. The white border is gone now.
 
I'm glad that you got rid of the white border.
Is the image quality good using the gif format? I would think the png format would produce a better, smoother picture since it supports partial transparency:
 

Attachments

  • gifVSpng.png
    gifVSpng.png
    42.9 KB · Views: 61
hmm.

The GIF-Quality is good but your png looks way better.

How did you convert the eps to png?

Would you post the converted images so I can download them?

thx in advance.
 
First I resized the eps using Image > Resize, resample using Smart Size as you did.
Then to exports to png: File > Export > PNG Optimizer...
Colors Tab: 16.7 Million Colors (24 Bit)
Transparency Tab: Alpha Channel Transparency, Existing image layer or transparency
Leave gamma alone and make sure the format is Non-interlaced (interlaced makes the file size larger).
And after doing all that I went back and simply used the saveas command saving as png and I got the same image, both are 19,607 bytes.
The gif image I created was only 5,448 bytes, but I think the measly 14,159 bytes is worth the extra quality.
And the png file is attached.
 

Attachments

  • auge klein.png
    auge klein.png
    19.1 KB · Views: 53
  • auge klein_new.png
    auge klein_new.png
    16.8 KB · Views: 55
  • auge klein_new_shadow.png
    auge klein_new_shadow.png
    21.1 KB · Views: 55
Last edited:
Hmm.

After a closer look, there is also a white border around the logo in your png file.

You can see it when you fill the background of the image with black in PSPX.
 
There's 3 png files attached above, but I'll assume you mean the original and not the new ones I created. The white border is in the original eps file.
You can open the original eps file and fill the background to verify.
I can come close to the original by recreating it. Let me know if you would like that image.
 
Hmm. Youre right. The white border comes from the original eps. I never thought of that. But like I said a few posts ago I exportet the pic to a gif with 50% error diffusion, and it worked out.

I think I use the gif now for my application.

Thx
 
Back
Top