Hello Experts,
I'm creating a bitmap object like this:
Bitmap myImage = new Bitmap(1024, 1024,
System.Drawing. Imaging.PixelFo rmat.Format24bp pRgb);
But when I invoking the function myImage .MakeTransparen t() (with or without
parameters), the myImage.PixelFo rmat changes to Format32bppArgb .
Why is that and how can I avoid it but still making the Bitmap transparent ?
----------
Thakns
Sharon 2 7526
The 24bpp pixel format doesn't define transparency (Alpha) and so the system
automatically changes to a format that can express the transparent value.
There is no way to display a 24bpp image with transparency on a per-pixel
basis.
--
Bob Powell [MVP]
Visual C#, System.Drawing
Ramuseco Limited .NET consulting http://www.ramuseco.com
Find great Windows Forms articles in Windows Forms Tips and Tricks http://www.bobpowell.net/tipstricks.htm
Answer those GDI+ questions with the GDI+ FAQ http://www.bobpowell.net/faqmain.htm
All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
"Sharon" <Sh*****@newsgr oups.nospam> wrote in message
news:1A******** *************** ***********@mic rosoft.com... Hello Experts,
I'm creating a bitmap object like this: Bitmap myImage = new Bitmap(1024, 1024, System.Drawing. Imaging.PixelFo rmat.Format24bp pRgb);
But when I invoking the function myImage .MakeTransparen t() (with or without parameters), the myImage.PixelFo rmat changes to Format32bppArgb .
Why is that and how can I avoid it but still making the Bitmap transparent ?
---------- Thakns Sharon
Hi Sharon,
Generally speaking, 24bit only includes RGB (three colors), not include
alpha value. So it can't produce transparent effect. I think this is the
reason when invoking the function MakeTransparent (), the PixelFormat
changes to Format32bppArgb . Because it will need alpha value(8 bits) to
generate transparent effect.
Best Regards,
Terry Fei [MSFT]
Microsoft Community Support
Get Secure! www.microsoft.com/security
-------------------- Thread-Topic: Why the Bitmap.MakeTran sparent() changes the PixelFormat ? thread-index: AcY7hrr3oc/UTJpZQTCPevbYtO uRWQ== X-WBNR-Posting-Host: 199.203.93.141 From: =?Utf-8?B?U2hhcm9u?= <Sh*****@newsgr oups.nospam> Subject: Why the Bitmap.MakeTran sparent() changes the PixelFormat ? Date: Mon, 27 Feb 2006 02:15:27 -0800 Lines: 15 Message-ID: <1A************ *************** *******@microso ft.com> MIME-Version: 1.0 Content-Type: text/plain; charset="Utf-8" Content-Transfer-Encoding: 7bit X-Newsreader: Microsoft CDO for Windows 2000 Content-Class: urn:content-classes:message Importance: normal Priority: normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0 Newsgroups: microsoft.publi c.dotnet.langua ges.csharp NNTP-Posting-Host: TK2MSFTNGXA03.p hx.gbl 10.40.2.250 Path: TK2MSFTNGXA01.p hx.gbl!TK2MSFTN GXA03.phx.gbl Xref: TK2MSFTNGXA01.p hx.gbl microsoft.publi c.dotnet.langua ges.csharp:3886 02 X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.csharp
Hello Experts,
I'm creating a bitmap object like this: Bitmap myImage = new Bitmap(1024, 1024, System.Drawing .Imaging.PixelF ormat.Format24b ppRgb);
But when I invoking the function myImage .MakeTransparen t() (with or
withoutparameters), the myImage.PixelFo rmat changes to Format32bppArgb .
Why is that and how can I avoid it but still making the Bitmap transparent
?
---------- Thakns Sharon This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Jax |
last post by:
Whenever I use this method I get out of memory exception, even when using tiny bitmaps (100X100)
Does anyone know why this is
From what I remember OutOfMemory Exception is a default for other exceptions, does anyone know what it might be
I am of course using try catch and finally blocks to ensure in cases of exceptions resources get released, I just can't understand why i'm always getting this exception
Help me people of the newsgroups,...
|
by: James Dean |
last post by:
I am drawing to an offscreen bitmap various shapes and so on. I have
created a bitmap for this purpose. But the bitmap has a black background
so i used the make transparent method to clear the background. But i use
scroll bars if the image is too big for the client area. When i scroll
down the screen cannot redraw itself correctly. If i dont use the
transparent method and the background is black it does not do this. I
saw in the...
|
by: James Dean |
last post by:
I create a bitmap like this.
The width and height are got from the compressed file i am reading. The
width and height are in pixels.....1bpp
bitmap = new Bitmap(Width,Height,PixelFormat.Format24bppRgb);
i have a bitmapdata class and then lock the bits like this.
bitmapData =
bitmap.LockBits(bounds, ImageLockMode.ReadWrite,
PixelFormat.Format24bppRgb);
|
by: Ma Xiaoguang |
last post by:
Dear ladies and gentlemen:
How to access all the pixels of a bitmap with C#? I am working with
Delphi before. In Delphi, you can use TBitmap.Scanline property to access
all the pixels of a bitmap object. How to do this with C#? Any hints? Thank
you very much.
Best regards.
Xiaoguang
|
by: Flix |
last post by:
Is there some way to convert a Bitmap from one PixelFormat (16bit or with
indexed colors) to another(24bit), without doing per pixel operations?
| |
by: nobody |
last post by:
How do I save a PictureBox bitmap with changes
drawn on the bitmap?
This doesn't do it:
PictureBox1.Image.Save("key30.bmp")
|
by: BIG_j |
last post by:
I have dynamic image(s) on the clipboard that I need to save as a
transparent gif. There are a number of posts regarding MakeTransparent but I
cannot get this to work for what I am trying to do. I am NOT loading the
picture into a form and there are no paint events to consider.
I am simply loading the image from the clipboard and saving it to a file.
Anyone have a solution or workaround??
Here is the code snippet...
|
by: John J. Hughes II |
last post by:
The following code throws a out of memory exception, I have another function
that does the same thing using the bitmap lock but its way slow. Anyone
know how to fix this one?
public static Bitmap GetClonedBitmap(int width, int height, string str, Font
font, StringAlignment Alignment)
{
Rectangle r = new Rectangle(1, 1, width-1, height-1);
using (Bitmap tmpBmp = new Bitmap(width, height))
{
|
by: Nathan Sokalski |
last post by:
I have created declared a Bitmap using the following statement:
Dim bmp As New Bitmap(100, 100, PixelFormat.Format8bppIndexed)
Because the SetPixel() method is disabled and a Graphics object cannot be
created for indexed PixelFormats, I am not sure how to edit the Bitmap. I am
assuming that there is some class or technique other than the following:
Dim bmpdata As BitmapData = bmp.LockBits(New Rectangle(0, 0, bmp.Width,
bmp.Height),...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |