|
-
Oct 30th, 2003, 12:26 AM
#1
how can I edit a gif file? CONFUSED AGAIN!
Well I can edit JPG files perfectly fine, but I tried a GIF file and I get this error:
A Graphics object cannot be created from an image that has an indexed pixel format.
I'm obviously trying to create a graphics object from the GIF image.
I've tried loading the GIF by using both of these methods:
dim img as image = image.fromfile(gifFile)
dim bmp as new bitmap(gifFile)
both will result the same. I'm wondering how I can "convert" the indexed format to a normal image so it can be edited with the Graphics class. There should certainly be a way, but I'm clueless
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
Oct 30th, 2003, 01:35 AM
#2
~
if a post is resolved, please mark it as [Resolved]
protected string get_Signature(){return Censored;}
[vbcode][php] please use code tags when posting any code [/php][/vbcode]
-
Oct 30th, 2003, 01:40 AM
#3
hmm I havent read that yet, but.... does this happen only with GIF files? can I just load and edit any other file types that .NET supports?
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
Oct 30th, 2003, 02:00 AM
#4
as far as i'm aware it's only Gif's that cause a problem , they have an indexing system and also it's something about the amount of colours, this is why you must specify " PixelFormat.Format8BPPIndexed " when making the new bitmap of the gif. eg:
VB Code:
Dim bitmap As Bitmap = New Bitmap(Width, Height, PixelFormat.Format8BppIndexed)
~
if a post is resolved, please mark it as [Resolved]
protected string get_Signature(){return Censored;}
[vbcode][php] please use code tags when posting any code [/php][/vbcode]
-
Oct 30th, 2003, 05:33 PM
#5
aah I cant get this to work. That article seems to be about SAVING a GIF file correctly. What I want it to be able to load the GIF and edit it with Graphics....
I tried doing this, but it wont work:
I locked the GIF as PixelFormat.Format8bppIndexed and created a bitmap and locked it with PixelFormat.Format24bppRgb. I tried copying every pixel of the GIF to the BMP file, but the result is a somewhat black and white image messed up... I dont know what I should do
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
Oct 31st, 2003, 05:18 PM
#6
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
Nov 1st, 2003, 02:32 AM
#7
hehe this seems to work
VB Code:
public static Bitmap ConvertFromIndexedFormat(Image img)
{
Bitmap bmp = new Bitmap(img.Width, img.Height);
Graphics gr = Graphics.FromImage(bmp);
gr.DrawImage (img, 0,0);
return bmp;
}
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|