473,396 Members | 1,886 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Proper image format to use for Alpha images?

Hey all. The images I create in photoshop with semi-transparent pixels (for
instance in Photoshop text with a dropshadow with a transparent canvas) I've
been saving in PNG format and then using them in my VB.NET app using the
picturebox control. I was really happy when I learned that you could use
PNG images in VB.NET so your images could blend in with the form's
background color. But, is PNG the ideal image format to use with these
types of images? I don't know if there is some other format that is
recommended for Alpha images other than PNG.

No big deal, just curious. Thanks.

Andrew
Nov 20 '05 #1
18 7407
* "Andrew Christiansen" <no-spam> scripsit:
Hey all. The images I create in photoshop with semi-transparent pixels (for
instance in Photoshop text with a dropshadow with a transparent canvas) I've
been saving in PNG format and then using them in my VB.NET app using the
picturebox control. I was really happy when I learned that you could use
PNG images in VB.NET so your images could blend in with the form's
background color. But, is PNG the ideal image format to use with these
types of images? I don't know if there is some other format that is
recommended for Alpha images other than PNG.


Why not? If PNG fits your requirements, it's perfect. Personally, I
like the PNG format and prefer it to GIF or JPEG.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #2
Why do you prefer it ?

Regards - OHM

Herfried K. Wagner [MVP] wrote:
* "Andrew Christiansen" <no-spam> scripsit:
Hey all. The images I create in photoshop with semi-transparent
pixels (for instance in Photoshop text with a dropshadow with a
transparent canvas) I've been saving in PNG format and then using
them in my VB.NET app using the picturebox control. I was really
happy when I learned that you could use PNG images in VB.NET so your
images could blend in with the form's background color. But, is PNG
the ideal image format to use with these types of images? I don't
know if there is some other format that is recommended for Alpha
images other than PNG.


Why not? If PNG fits your requirements, it's perfect. Personally, I
like the PNG format and prefer it to GIF or JPEG.


Regards - OHM# OneHandedMan{at}BTInternet{dot}com
Nov 20 '05 #3
* "One Handed Man [ OHM# ]" <OneHandedMan{at}BTInternet{dot}com> scripsit:
Why do you prefer it ?


It's an open and very flexible format.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #4
Im not that familiar with it, what are the basic differences, ( things you
can do with PNG ) that you cant with the JPEg for example ?

OHM

Herfried K. Wagner [MVP] wrote:
* "One Handed Man [ OHM# ]" <OneHandedMan{at}BTInternet{dot}com>
scripsit:
Why do you prefer it ?


It's an open and very flexible format.


Regards - OHM# OneHandedMan{at}BTInternet{dot}com
Nov 20 '05 #5
Hey dont worry, PNG looks good.
http://www.aurigma.com/support/defau...ncoderInfo.htm
Andrew Christiansen wrote:
Hey all. The images I create in photoshop with semi-transparent
pixels (for instance in Photoshop text with a dropshadow with a
transparent canvas) I've been saving in PNG format and then using
them in my VB.NET app using the picturebox control. I was really
happy when I learned that you could use PNG images in VB.NET so your
images could blend in with the form's background color. But, is PNG
the ideal image format to use with these types of images? I don't
know if there is some other format that is recommended for Alpha
images other than PNG.

No big deal, just curious. Thanks.

Andrew


Regards - OHM# OneHandedMan{at}BTInternet{dot}com
Nov 20 '05 #6
Cor
Hi Herfried,

Serious, I also want to know that as OHM.

Because I thougth JPG has more posibilities in .Net
(I did not see much with encoding at PNG, but I can be wrong)

Cor
Nov 20 '05 #7
* "Cor" <no*@non.com> scripsit:
Serious, I also want to know that as OHM.

Because I thougth JPG has more posibilities in .Net
(I did not see much with encoding at PNG, but I can be wrong)


It depends on what you want to do...

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #8
Cor
Hi Herfried,
It depends on what you want to do...


I forgot to reference by value to the message from OHM,
Im not that familiar with it, what are the basic differences, ( things you
can do with PNG ) that you cant with the JPEg for example ?


Cor


Nov 20 '05 #9
Hey everyone. Maybe I can clear up PNG format really quickly cause it seems
not a lot of people are taking advantage of PNG image support in VB.NET.
PNG has way more possibilities than JPEG, GIF, or BMP. The PNG format can
hold pixels that are semi-transparent (commonly called Alpha blending). For
instance in the JPEG, GIF, or BMP format, either a pixel is transparent (the
pixel behind the transparent pixel in the image is shown completely through)
or its not transparent (the pixel behind isn't visible at all). But, the
PNG format can have pixels that let the pixel behind it shine through
half-way on a scale 0 - 255 (0 being totally transparent, 255 being totally
opaque). VB.NET supports the PNG format, so you can create high quality
anti-aliased images with, for instance, drop shadows that blend in with your
form's background color, not matter what color it is.

To demonstrate, create a new Photoshop image that is 16x16 in size with a
transparent background. Create a new layer. Choose a solid red color (R:
255, G: 0, B: 0), and use the paint bucket to fill the new layer with the
color. Set the opacity of the new layer to 50% (that means all the pixels
in that layer let any pixels underneath it shine through it just half way).
Because there is nothing underneath that layer, you should see a slight
glimpse of the checkerboard through the solid red pixels (in Photoshop the
checkerboard symbolizes transparency). Now click File > Save As... > and
save as a PNG file. Create a VB.NET project and add a picturebox to the
form and load the PNG image into the picture box. Wow! Notice how the
BackColor of the picturebox is shining 50% through the solid red. Now
change the BackColor to a different color, see, it always blends 50% with
the solid red pixels. Now try saving as a JPEG and loading it into the
picture box, the 50% red pixels don't blend with the background color,
because JPEG doesn't support Alpha blending.

Whew. Tried my best to explain that as best I could, hopefully I didn't get
anything wrong. In my opinion everybody should use PNG images in their .NET
projects. Hope this helps anyone out.

Andrew
"Andrew Christiansen" <no-spam> wrote in message
news:OS**************@TK2MSFTNGP10.phx.gbl...
Hey all. The images I create in photoshop with semi-transparent pixels (for instance in Photoshop text with a dropshadow with a transparent canvas) I've been saving in PNG format and then using them in my VB.NET app using the
picturebox control. I was really happy when I learned that you could use
PNG images in VB.NET so your images could blend in with the form's
background color. But, is PNG the ideal image format to use with these
types of images? I don't know if there is some other format that is
recommended for Alpha images other than PNG.

No big deal, just curious. Thanks.

Andrew

Nov 20 '05 #10
I agree with you... I have only one objection to it... is quite big reported
to the other ones... a 10k gif is 150K png... ok, no levels of transparency
only 1 or 0 ...
Depending on application it whould like to have a function that take the
full opaque image, a grayscale mask and render a translucent image
acordingly to the levels of grays ...
I whould like that implemented in Framework, to avoid using unmanaged code
to do it myself... speed is an issue for managed code

--
Cheers,
Crirus

------------------------------
If work were a good thing, the boss would take it all from you

------------------------------

"Andrew Christiansen" <no-spam> wrote in message
news:O1**************@tk2msftngp13.phx.gbl...
Hey everyone. Maybe I can clear up PNG format really quickly cause it seems not a lot of people are taking advantage of PNG image support in VB.NET.
PNG has way more possibilities than JPEG, GIF, or BMP. The PNG format can
hold pixels that are semi-transparent (commonly called Alpha blending). For instance in the JPEG, GIF, or BMP format, either a pixel is transparent (the pixel behind the transparent pixel in the image is shown completely through) or its not transparent (the pixel behind isn't visible at all). But, the
PNG format can have pixels that let the pixel behind it shine through
half-way on a scale 0 - 255 (0 being totally transparent, 255 being totally opaque). VB.NET supports the PNG format, so you can create high quality
anti-aliased images with, for instance, drop shadows that blend in with your form's background color, not matter what color it is.

To demonstrate, create a new Photoshop image that is 16x16 in size with a
transparent background. Create a new layer. Choose a solid red color (R:
255, G: 0, B: 0), and use the paint bucket to fill the new layer with the
color. Set the opacity of the new layer to 50% (that means all the pixels
in that layer let any pixels underneath it shine through it just half way). Because there is nothing underneath that layer, you should see a slight
glimpse of the checkerboard through the solid red pixels (in Photoshop the
checkerboard symbolizes transparency). Now click File > Save As... > and
save as a PNG file. Create a VB.NET project and add a picturebox to the
form and load the PNG image into the picture box. Wow! Notice how the
BackColor of the picturebox is shining 50% through the solid red. Now
change the BackColor to a different color, see, it always blends 50% with
the solid red pixels. Now try saving as a JPEG and loading it into the
picture box, the 50% red pixels don't blend with the background color,
because JPEG doesn't support Alpha blending.

Whew. Tried my best to explain that as best I could, hopefully I didn't get anything wrong. In my opinion everybody should use PNG images in their ..NET projects. Hope this helps anyone out.

Andrew
"Andrew Christiansen" <no-spam> wrote in message
news:OS**************@TK2MSFTNGP10.phx.gbl...
Hey all. The images I create in photoshop with semi-transparent pixels

(for
instance in Photoshop text with a dropshadow with a transparent canvas)

I've
been saving in PNG format and then using them in my VB.NET app using the
picturebox control. I was really happy when I learned that you could use PNG images in VB.NET so your images could blend in with the form's
background color. But, is PNG the ideal image format to use with these
types of images? I don't know if there is some other format that is
recommended for Alpha images other than PNG.

No big deal, just curious. Thanks.

Andrew


Nov 20 '05 #11
Cor
Hi Crirus,

That was my thought also but with all that experts around

:-))

Cor
I agree with you... I have only one objection to it... is quite big reported to the other ones... a 10k gif is 150K png... ok, no levels of transparency only 1 or 0 ...

Nov 20 '05 #12
Yeah, I tryed all I could find about transparency as I work with sprites and
shadows on my game graphics... I have a internet explorer client that should
be transfered on player machine and connect back to server for data..anyway
I try to shrink as much as possible the client to minimise the data
transfered....
Now, with a set of sprites as png, my client becamed so quick 2 Mega on size
so I dropped the ideea...
I use gifs instead and sime tricks to do shadows... but still whould be
better to have a maskBlt in GDI+, as fast as possible, without need of
unmanaged memory :)

--
Cheers,
Crirus

------------------------------
If work were a good thing, the boss would take it all from you

------------------------------

"Cor" <no*@non.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hi Crirus,

That was my thought also but with all that experts around

:-))

Cor
I agree with you... I have only one objection to it... is quite big

reported
to the other ones... a 10k gif is 150K png... ok, no levels of

transparency
only 1 or 0 ...


Nov 20 '05 #13
* "Crirus" <Cr****@datagroup.ro> scripsit:
I agree with you... I have only one objection to it... is quite big reported
to the other ones... a 10k gif is 150K png... ok, no levels of transparency
only 1 or 0 ...
.... and a limitation to 256 colors in GIF format.
Depending on application it whould like to have a function that take the
full opaque image, a grayscale mask and render a translucent image
acordingly to the levels of grays ...
I whould like that implemented in Framework, to avoid using unmanaged code
to do it myself... speed is an issue for managed code


Yopu will have to use C# + 'unsafe' blacks in order to archieve a good
performance:

Part 1: <http://www.codeproject.com/cs/media/csharpgraphicfilters11.asp>
Part 2: <http://www.codeproject.com/cs/media/csharpfilters.asp>
Part 3: <http://www.codeproject.com/cs/media/edge_detection.asp>
Part 4: <http://www.codeproject.com/cs/media/imageprocessing4.asp>
Part 5: <http://www.codeproject.com/cs/media/DisplacementFilters.asp>

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #14
* "Andrew Christiansen" <no-spam> scripsit:
Whew. Tried my best to explain that as best I could, hopefully I didn't get
anything wrong. In my opinion everybody should use PNG images in their .NET
projects. Hope this helps anyone out.


Thank you for the really excellent explanation!

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #15
Cor
Hi Andrew,

Thanks you also, it gives a new shining on my knowledge of this, when the
time is there I will try it, but for now I know it and because of your
explanation I believe you without trying it.

Thanks.

Cor
Hey everyone. Maybe I can clear up PNG format really quickly cause it seems not a lot of people are taking advantage of PNG image support in VB.NET.
PNG has way more possibilities than JPEG, GIF, or BMP. The PNG format can
hold pixels that are semi-transparent (commonly called Alpha blending). For instance in the JPEG, GIF, or BMP format, either a pixel is transparent (the pixel behind the transparent pixel in the image is shown completely through) or its not transparent (the pixel behind isn't visible at all). But, the
PNG format can have pixels that let the pixel behind it shine through
half-way on a scale 0 - 255 (0 being totally transparent, 255 being totally opaque). VB.NET supports the PNG format, so you can create high quality
anti-aliased images with, for instance, drop shadows that blend in with your form's background color, not matter what color it is.

To demonstrate, create a new Photoshop image that is 16x16 in size with a
transparent background. Create a new layer. Choose a solid red color (R:
255, G: 0, B: 0), and use the paint bucket to fill the new layer with the
color. Set the opacity of the new layer to 50% (that means all the pixels
in that layer let any pixels underneath it shine through it just half way). Because there is nothing underneath that layer, you should see a slight
glimpse of the checkerboard through the solid red pixels (in Photoshop the
checkerboard symbolizes transparency). Now click File > Save As... > and
save as a PNG file. Create a VB.NET project and add a picturebox to the
form and load the PNG image into the picture box. Wow! Notice how the
BackColor of the picturebox is shining 50% through the solid red. Now
change the BackColor to a different color, see, it always blends 50% with
the solid red pixels. Now try saving as a JPEG and loading it into the
picture box, the 50% red pixels don't blend with the background color,
because JPEG doesn't support Alpha blending.

Whew. Tried my best to explain that as best I could, hopefully I didn't get anything wrong. In my opinion everybody should use PNG images in their ..NET projects. Hope this helps anyone out.

Andrew
"Andrew Christiansen" <no-spam> wrote in message
news:OS**************@TK2MSFTNGP10.phx.gbl...
Hey all. The images I create in photoshop with semi-transparent pixels

(for
instance in Photoshop text with a dropshadow with a transparent canvas)

I've
been saving in PNG format and then using them in my VB.NET app using the
picturebox control. I was really happy when I learned that you could use PNG images in VB.NET so your images could blend in with the form's
background color. But, is PNG the ideal image format to use with these
types of images? I don't know if there is some other format that is
recommended for Alpha images other than PNG.

No big deal, just curious. Thanks.

Andrew


Nov 20 '05 #16
Yeah, but an untrusted env dont allow me to use Marshal

--
Cheers,
Crirus

------------------------------
If work were a good thing, the boss would take it all from you

------------------------------

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
* "Crirus" <Cr****@datagroup.ro> scripsit:
I agree with you... I have only one objection to it... is quite big reported to the other ones... a 10k gif is 150K png... ok, no levels of transparency only 1 or 0 ...


... and a limitation to 256 colors in GIF format.
Depending on application it whould like to have a function that take the
full opaque image, a grayscale mask and render a translucent image
acordingly to the levels of grays ...
I whould like that implemented in Framework, to avoid using unmanaged code to do it myself... speed is an issue for managed code


Yopu will have to use C# + 'unsafe' blacks in order to archieve a good
performance:

Part 1: <http://www.codeproject.com/cs/media/csharpgraphicfilters11.asp>
Part 2: <http://www.codeproject.com/cs/media/csharpfilters.asp>
Part 3: <http://www.codeproject.com/cs/media/edge_detection.asp>
Part 4: <http://www.codeproject.com/cs/media/imageprocessing4.asp>
Part 5: <http://www.codeproject.com/cs/media/DisplacementFilters.asp>

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #17
Cor
Hi Herfried,

What is the different between posters, when I was begging to you for this
links I got nothing, now I am busy with something else but I think then it
could have helped me.

Cor

Part 1: <http://www.codeproject.com/cs/media/csharpgraphicfilters11.asp>
Part 2: <http://www.codeproject.com/cs/media/csharpfilters.asp>
Part 3: <http://www.codeproject.com/cs/media/edge_detection.asp>
Part 4: <http://www.codeproject.com/cs/media/imageprocessing4.asp>
Part 5: <http://www.codeproject.com/cs/media/DisplacementFilters.asp>

Nov 20 '05 #18
* "Cor" <no*@non.com> scripsit:
What is the different between posters, when I was begging to you for this
links I got nothing, now I am busy with something else but I think then it
could have helped me.


You really wanted these links?

;-)))
Part 1: <http://www.codeproject.com/cs/media/csharpgraphicfilters11.asp>
Part 2: <http://www.codeproject.com/cs/media/csharpfilters.asp>
Part 3: <http://www.codeproject.com/cs/media/edge_detection.asp>
Part 4: <http://www.codeproject.com/cs/media/imageprocessing4.asp>
Part 5: <http://www.codeproject.com/cs/media/DisplacementFilters.asp>


--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #19

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Mr. x | last post by:
Hello, I would like that my image's background color will be transparent. What I have is only paintbrush. My image is *.jpg format (I have tried to save it as *.gif format, and I got less...
21
by: DraguVaso | last post by:
Hi, I have an inherited DataGrid, that does lots of extra stuff. For exemple drawing a backgroundimage in every cell. The problem is that it's taking too much time (using gdi+), so I want to do...
1
by: Baramuse | last post by:
Hi, I wonder if it was possible to change the opacity of an image in a picturebox for example : I try to make a splash screen that shows up images (one after one). But i would like to change the...
6
by: felix | last post by:
Hi, I have an Image that is drawn with Graphics.DrawImage(..). What I want to do is drawing it with a given transparency, e.g. at an alpha of only 180 instead of 255. How am I doing that?!?!?...
1
by: RicercatoreSbadato | last post by:
I have notice that my images have the value Image.Flags = 2 (HasAlpha). How Can I set the Flags to 1? I would like to eliminate the alpha channel... -- RicercatoreSbadato
5
by: yxq | last post by:
Hello The icons with the alpha channel are supported in WindowsXP. If use the System.Drawing.Bitmap.ToBitmap on the icon handle(ico.ToBitmap), the alpha channel won't be preserved, resulting in an...
1
by: jitu78 | last post by:
GIF Images Use GIF files for images that have a small number of colors. GIF files are always reduced to no more than 256 unique colors. The compression algorithm for GIF files is less complex than...
2
by: PJ6 | last post by:
I am rendering a few graphs with GDI+ and sending images to a web page. What image format is lightweight and the best for presenting line drawings sharply and without compression artifacts? GIF?...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.