473,395 Members | 1,649 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,395 software developers and data experts.

SetPixel Issue

I would like to change some pixels inside a particular gif file. I
tried using the setpixel and noticed that it is not compatible with
indexed images. Then I converted the file from a gif to a bmp using the
following syntax

imgDiskImage.Save(sNewFile, imgFormat)

Altough the file was converted it failed again when setpixel was called
in the statement

BMImage.SetPixel(Xindex, Yindex, Color.Cyan)

The error message in all the occasions is -
SetPixel is not supported for images with indexed pixel formats.

If I have converted the file to bitmap image why it is still failing?
What I should change? BMImage as declared as
Dim BMImage As Bitmap = CType(Image.FromFile(StrFileNamePath), Bitmap)

I have opened a bmp file created by windows paint and there were no
issues with the setpixel. So I've tried converting the gif file with
Microsoft Office Picture Manager to a bmp but this also failed.

Strange

Thanks
Jansen

Jan 7 '07 #1
1 2340
<ta*********@hotmail.comschrieb:
>I would like to change some pixels inside a particular gif file. I
tried using the setpixel and noticed that it is not compatible with
indexed images. Then I converted the file from a gif to a bmp using the
following syntax

imgDiskImage.Save(sNewFile, imgFormat)

Altough the file was converted it failed again when setpixel was called
in the statement

BMImage.SetPixel(Xindex, Yindex, Color.Cyan)

The error message in all the occasions is -
SetPixel is not supported for images with indexed pixel formats.

If I have converted the file to bitmap image why it is still failing?
The 'Bitmap' class can store both indexed and non-indexed images. GIF files
use a color table and are thus indexed. However, just create a new image of
the same size, use 'Graphics.FromImage(<new bitmap>)' to get a 'Graphics'
object and pass the image object containing the GIF file to its 'DrawImage'
method.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Jan 7 '07 #2

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

Similar topics

2
by: timeash | last post by:
The code below subtracts two images from one another and determines if there is any new things in the picture. A large enough color change will "register" a pixel. The pixel is then plotted using...
1
by: Peter | last post by:
Hi, I found the SetPixel performance is very poor. it took lots of time to twist dots for a large image. I wonder if there is any other way to speed it up. Thanks. Peter ...
3
by: halise | last post by:
Hi, i am in trouble with an exception in .net platform with c#. The exception thrown is exactly as follows: System.ArgumentException: Invalid parameter used. at...
0
by: mark | last post by:
Somebody can explain me why if I put a color with SetPixel the color showed is of another value? For example: I've to draw a grayscale image. The color RGB(90,90,90) become RGB(40,45,60). In the...
2
by: Matthew | last post by:
I have put the following in my Form1_Load event: Dim Img As Bitmap = New Bitmap(1, 1) Img.SetPixel(0, 0, Color.Green) BackgroundImage = Img TransparencyKey = Img.GetPixel(0, 0) This makes...
3
by: Atmapuri | last post by:
Hi! I was profiling a drawing applicationa and Bitmap.SetPixel is consuming 90% of all CPU. Is there an alternative way to create the bitmap and fill it with data that is stored in an array of...
0
by: Anil Gupte | last post by:
I am using an Image Button from Microsoft's Power Pack. When I use the ..Enabled=True/False I get the following error "SetPixel is not supported for images with indexed pixel formats" I am...
3
by: Seabass | last post by:
Hello everyone, I have to do an image viewer for an exotic format so I want to know how to place pixels somewhere on the form or on some object. I tried doing this but it works incredibly...
13
by: SAL | last post by:
Hello, I'm trying to include a popup in the ItemTemplate of a gridview row. The ItemTemplate for the field contains a textbox and when the user clicks in the textbox I want a popup panel to show...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
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.