473,698 Members | 2,490 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PixelFormat.For mat8bppIndexed in Bitmap Hangs!

Mil
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.W idth, source.Height, PixelFormat.For mat8bppIndexed) ;

The result was that program stopped executing and started to hang. If I
create a Bitmap
with a constructor Bitmap(source.W idth, source.Height) everything is
ok.

Does anyone know what happends when I give PixelFormat class as an
third parameter
to Bitmap's constructor?

So, If this does not work how should I create different type of Bitmaps
with different features?

My purpose is to convert Color Tiff image to as light GrayScale Tiff
image as possible (ligth = size of the file is smallest). Can C#'s
Image handling classes help me or not.. anyone know
about this?

Cheers.

Jan 13 '06 #1
0 3829

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

Similar topics

3
33568
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?
2
1489
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
37656
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)
2
7526
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 ?
7
8239
by: Fir5tSight | last post by:
Hi All, I used the following code in C#: using System.Drawing; //blah blah blah Bitmap bmp = new Bitmap();
14
11900
by: eliss.carmine | last post by:
I'm using TCP/IP to send a Bitmap object over Sockets. This is my first time using C# at all so I don't know if this is the "right" way to do it. I've already found out several times the way I was doing something was really inefficient and could reduce 10 lines of code with 2, etc. For reading, I am using a TcpClient and I call NetworkStream ns = client.GetStream(); to get a stream stream.Read(buffer, 0, buffer.Length);
2
2688
by: Pierre Rouleau | last post by:
Hi all, I have a consistent test case where os.popen3() hangs in Windows. The system hangs when retrieving the lines from the child process stdout. I know there were several reports related to os.popen3() hanging under Windows in this group before. I stumbled on a case where a piece of code works in some occasions and hangs consistently given different data. It performs exactly the same on 3 different computers running Windows:
1
6469
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
1927
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
8685
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
8612
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
9171
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...
1
8905
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,...
0
7743
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
6532
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
4373
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4625
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3053
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.