473,748 Members | 7,608 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Altering the PixelFormat of an Image

If you have a bitmap, but need for it to be of a different PixelFormat, how
can you do that? PixelFormat is ReadOnly. Does it have to be done while
Drawing to a graphics object? I wonder if there's a code sample available
somewhere in which this is done. Thanks

Phil Galey
Nov 21 '05 #1
2 1495
Hi,

Create a new bitmap and specify the pixelformat in the
constructor. Draw the old image on the new bitmap.

Ken
---------------------
"Phil Galey" <pa*****@starca lif.com.nospam> wrote in message
news:%2******** ********@TK2MSF TNGP14.phx.gbl. ..
If you have a bitmap, but need for it to be of a different PixelFormat, how
can you do that? PixelFormat is ReadOnly. Does it have to be done while
Drawing to a graphics object? I wonder if there's a code sample available
somewhere in which this is done. Thanks

Phil Galey

Nov 21 '05 #2
Hi,

Create a new bitmap and specify the pixelformat in the
constructor. Draw the old image on the new bitmap.

Ken
---------------------
"Phil Galey" <pa*****@starca lif.com.nospam> wrote in message
news:%2******** ********@TK2MSF TNGP14.phx.gbl. ..
If you have a bitmap, but need for it to be of a different PixelFormat, how
can you do that? PixelFormat is ReadOnly. Does it have to be done while
Drawing to a graphics object? I wonder if there's a code sample available
somewhere in which this is done. Thanks

Phil Galey

Nov 21 '05 #3

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

Similar topics

3
33572
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?
0
258
by: Phil Galey | last post by:
If you have a bitmap, but need for it to be of a different PixelFormat, how can you do that? PixelFormat is ReadOnly. Does it have to be done while Drawing to a graphics object? I wonder if there's a code sample available somewhere in which this is done. Thanks Phil Galey
3
37659
by: johnb41 | last post by:
I need to use the bitmap.getpixel method to work on the pixel level of an image. But GetPixel will not work with Indexed images. The images that i work with are black & white text scans. I create the bitmap object like this: Dim b As Bitmap = Bitmap.FromFile("c:\scan.tif") But I want to convert this file to PixelFormat.Format24bppRgb (or something NOT indexed)
0
3834
by: Mil | last post by:
Hello, I'm trying to convert Images using Bitmap class. I want to use different options for example reduce the size of image. In my code I tried to create a Bitmap class instance with a Bitmap's constructor: new Bitmap(source.Width, source.Height, PixelFormat.Format8bppIndexed);
2
7532
by: Sharon | last post by:
Hello Experts, I'm creating a bitmap object like this: Bitmap myImage = new Bitmap(1024, 1024, System.Drawing.Imaging.PixelFormat.Format24bppRgb); But when I invoking the function myImage .MakeTransparent() (with or without parameters), the myImage.PixelFormat changes to Format32bppArgb. Why is that and how can I avoid it but still making the Bitmap transparent ?
9
8390
by: JimmyKoolPantz | last post by:
IDE: Visual Studio 2005 Language: VB.NET Fox Pro Driver Version: 9.0.0.3504 Problem: I currently have a problem altering a DBF file. I do not get any syntax errors when running the program. However, after I alter the table and open microsoft excel to look at any changes; I get the following error: "This file is not in a recognizable format" If I do open the file in excel it looks like its not formatted.
1
5160
by: zufie | last post by:
Hi, I want to specifying a foreign key by altering a table. First, I create an ORDERS table without specifying a foreign key. Here is my code: CREATE TABLE ORDERS (Order_ID integer, Order_Date date, Customer_SID integer,
1
6471
by: theShmit | last post by:
I am writing a regression testing suite that uses some image comparison features for some RFI (radio frequency interference) testing equipment. I capture an image (from the screen of the device), and save this first image as a reference as “what the screen should look like;” then when executing a “macro” on the device, I will then capture another image and compare it to the “reference” image – the details aren’t important, but FYI. The...
1
1933
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),...
0
8989
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, 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...
0
8828
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,...
0
9537
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, 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...
0
9367
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9243
tracyyun
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...
0
8241
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, 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...
1
6795
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4869
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2213
bsmnconsultancy
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...

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.