PC Review


Reply
Thread Tools Rate Thread

ICO to GIF? (transparant)

 
 
Edwin Knoppert
Guest
Posts: n/a
 
      7th Dec 2005
I'm trying to convert an icon handle to GIF.

Something like:
Public Function GetImageFromIconHandle(ByVal hIcon As Int32) As Int32
Dim ico As Icon = Icon.FromHandle(hIcon)
Dim x As New Drawing.IconConverter
'x.ConvertTo(ico,typeof(System.Drawing.Imaging.ImageFormat.Gif) )
End Function

x.ConvertTo(ico, <requires a system.type> )

I don't know how to do that.
Important is that a transparent icon should remain transparent.

hIcon is a valid 16x16 icon.


 
Reply With Quote
 
 
 
 
Daniel Fisher\(lennybacon\)
Guest
Posts: n/a
 
      7th Dec 2005
Have you tried typeof(Bitmap) ?

--
Daniel Fisher(lennybacon)
http://www.lennybacon.com


"Edwin Knoppert" <(E-Mail Removed)> wrote in message
news:4396d335$0$2340$(E-Mail Removed)...
> I'm trying to convert an icon handle to GIF.
>
> Something like:
> Public Function GetImageFromIconHandle(ByVal hIcon As Int32) As Int32
> Dim ico As Icon = Icon.FromHandle(hIcon)
> Dim x As New Drawing.IconConverter
> 'x.ConvertTo(ico,typeof(System.Drawing.Imaging.ImageFormat.Gif) )
> End Function
>
> x.ConvertTo(ico, <requires a system.type> )
>
> I don't know how to do that.
> Important is that a transparent icon should remain transparent.
>
> hIcon is a valid 16x16 icon.
>
>



 
Reply With Quote
 
 
 
 
Edwin Knoppert
Guest
Posts: n/a
 
      7th Dec 2005
That would not work but..

i already converted to bmp and i used that code.
But the backcolor remains black while i added:
Dim bmp As Bitmap = ico.ToBitmap
bmp.MakeTransparent(Color.Black)
Return bmp

The image remains the same though.
Better see a real example with a transparent ico > gif.

Your suggestion:
For the type i used: x.ConvertTo(ico, bmp.GetType)
But i don't know what to use to draw to user, and even to expect a
transparent gif since i still use a bitmap object (GIF is bitmap so i should
give it a chance).

Currently the BMP is shown:
Response.ContentType = "image/gif"
Dim xx As System.Drawing.Imaging.ImageFormat
' send the image to the viewer
bmp.Save(Response.OutputStream, xx.Gif)

bmp.Dispose()
Response.End()



"Daniel Fisher(lennybacon)" <(E-Mail Removed)> schreef in bericht
news:Olcg11y%(E-Mail Removed)...
> Have you tried typeof(Bitmap) ?
>
> --
> Daniel Fisher(lennybacon)
> http://www.lennybacon.com
>
>
> "Edwin Knoppert" <(E-Mail Removed)> wrote in message
> news:4396d335$0$2340$(E-Mail Removed)...
>> I'm trying to convert an icon handle to GIF.
>>
>> Something like:
>> Public Function GetImageFromIconHandle(ByVal hIcon As Int32) As Int32
>> Dim ico As Icon = Icon.FromHandle(hIcon)
>> Dim x As New Drawing.IconConverter
>> 'x.ConvertTo(ico,typeof(System.Drawing.Imaging.ImageFormat.Gif) )
>> End Function
>>
>> x.ConvertTo(ico, <requires a system.type> )
>>
>> I don't know how to do that.
>> Important is that a transparent icon should remain transparent.
>>
>> hIcon is a valid 16x16 icon.
>>
>>

>
>



 
Reply With Quote
 
Nathan Sokalski
Guest
Posts: n/a
 
      7th Dec 2005
Making an image transparent in .NET is a rather complicated process, which I
don't quite understand. Here is a page that I was referred to by someone in
a newsgroup which is supposed to work. It is written in C#. I am a VB.NET
coder, and I couldn't get it to work in that, but I think that is due to the
unmanaged code capabilities of C#. I have not tried the code in C#, so I am
assuming it would work if I did it in C#. See what it does for you. (If you
do figure out a way to get it to work in VB.NET, could you let me know?)
Here is the URL:

http://ewbi.blogs.com/develops/2005/...klines_22.html

Good Luck!
--
Nathan Sokalski
(E-Mail Removed)
http://www.nathansokalski.com/

"Edwin Knoppert" <(E-Mail Removed)> wrote in message
news:4396deba$0$2342$(E-Mail Removed)...
> That would not work but..
>
> i already converted to bmp and i used that code.
> But the backcolor remains black while i added:
> Dim bmp As Bitmap = ico.ToBitmap
> bmp.MakeTransparent(Color.Black)
> Return bmp
>
> The image remains the same though.
> Better see a real example with a transparent ico > gif.
>
> Your suggestion:
> For the type i used: x.ConvertTo(ico, bmp.GetType)
> But i don't know what to use to draw to user, and even to expect a
> transparent gif since i still use a bitmap object (GIF is bitmap so i
> should give it a chance).
>
> Currently the BMP is shown:
> Response.ContentType = "image/gif"
> Dim xx As System.Drawing.Imaging.ImageFormat
> ' send the image to the viewer
> bmp.Save(Response.OutputStream, xx.Gif)
>
> bmp.Dispose()
> Response.End()
>
>
>
> "Daniel Fisher(lennybacon)" <(E-Mail Removed)> schreef in bericht
> news:Olcg11y%(E-Mail Removed)...
>> Have you tried typeof(Bitmap) ?
>>
>> --
>> Daniel Fisher(lennybacon)
>> http://www.lennybacon.com
>>
>>
>> "Edwin Knoppert" <(E-Mail Removed)> wrote in message
>> news:4396d335$0$2340$(E-Mail Removed)...
>>> I'm trying to convert an icon handle to GIF.
>>>
>>> Something like:
>>> Public Function GetImageFromIconHandle(ByVal hIcon As Int32) As Int32
>>> Dim ico As Icon = Icon.FromHandle(hIcon)
>>> Dim x As New Drawing.IconConverter
>>> 'x.ConvertTo(ico,typeof(System.Drawing.Imaging.ImageFormat.Gif) )
>>> End Function
>>>
>>> x.ConvertTo(ico, <requires a system.type> )
>>>
>>> I don't know how to do that.
>>> Important is that a transparent icon should remain transparent.
>>>
>>> hIcon is a valid 16x16 icon.
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
Edwin Knoppert
Guest
Posts: n/a
 
      7th Dec 2005
Thanks, will take a peek tomorrow

It's a bit odd though, both types support tranparancy.
So some conversion unit could 'know' what get's transparent (imo).
Conversion to plain BMP first is prob.not ok.
However dotnet has a maketransparent method, and i was hoping this would
work at least.
I did not see any difference.

But hey.. what do i know?


"Nathan Sokalski" <(E-Mail Removed)> schreef in bericht
news:eaW0oQ3%(E-Mail Removed)...
> Making an image transparent in .NET is a rather complicated process, which
> I don't quite understand. Here is a page that I was referred to by someone
> in a newsgroup which is supposed to work. It is written in C#. I am a
> VB.NET coder, and I couldn't get it to work in that, but I think that is
> due to the unmanaged code capabilities of C#. I have not tried the code in
> C#, so I am assuming it would work if I did it in C#. See what it does for
> you. (If you do figure out a way to get it to work in VB.NET, could you
> let me know?) Here is the URL:
>
> http://ewbi.blogs.com/develops/2005/...klines_22.html
>
> Good Luck!
> --
> Nathan Sokalski
> (E-Mail Removed)
> http://www.nathansokalski.com/
>
> "Edwin Knoppert" <(E-Mail Removed)> wrote in message
> news:4396deba$0$2342$(E-Mail Removed)...
>> That would not work but..
>>
>> i already converted to bmp and i used that code.
>> But the backcolor remains black while i added:
>> Dim bmp As Bitmap = ico.ToBitmap
>> bmp.MakeTransparent(Color.Black)
>> Return bmp
>>
>> The image remains the same though.
>> Better see a real example with a transparent ico > gif.
>>
>> Your suggestion:
>> For the type i used: x.ConvertTo(ico, bmp.GetType)
>> But i don't know what to use to draw to user, and even to expect a
>> transparent gif since i still use a bitmap object (GIF is bitmap so i
>> should give it a chance).
>>
>> Currently the BMP is shown:
>> Response.ContentType = "image/gif"
>> Dim xx As System.Drawing.Imaging.ImageFormat
>> ' send the image to the viewer
>> bmp.Save(Response.OutputStream, xx.Gif)
>>
>> bmp.Dispose()
>> Response.End()
>>
>>
>>
>> "Daniel Fisher(lennybacon)" <(E-Mail Removed)> schreef in bericht
>> news:Olcg11y%(E-Mail Removed)...
>>> Have you tried typeof(Bitmap) ?
>>>
>>> --
>>> Daniel Fisher(lennybacon)
>>> http://www.lennybacon.com
>>>
>>>
>>> "Edwin Knoppert" <(E-Mail Removed)> wrote in message
>>> news:4396d335$0$2340$(E-Mail Removed)...
>>>> I'm trying to convert an icon handle to GIF.
>>>>
>>>> Something like:
>>>> Public Function GetImageFromIconHandle(ByVal hIcon As Int32) As Int32
>>>> Dim ico As Icon = Icon.FromHandle(hIcon)
>>>> Dim x As New Drawing.IconConverter
>>>> 'x.ConvertTo(ico,typeof(System.Drawing.Imaging.ImageFormat.Gif) )
>>>> End Function
>>>>
>>>> x.ConvertTo(ico, <requires a system.type> )
>>>>
>>>> I don't know how to do that.
>>>> Important is that a transparent icon should remain transparent.
>>>>
>>>> hIcon is a valid 16x16 icon.
>>>>
>>>>
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
Nathan Sokalski
Guest
Posts: n/a
 
      8th Dec 2005
Don't let that make you feel too bad, my first attempt at transparency was
to use the MakeTransparent method, too. To be honest, I think that there
should be a method (or maybe a predefined Color, or maybe a separate class
that inherits something from GDI+ that is used for making transparent
images) that makes it simpler. Maybe if we're lucky that make one in a
future release of .NET, because if you think about it, transparency is used
in almost all gif images, I mean, when was the last time you saw a button or
logo that was completely rectangular?
--
Nathan Sokalski
(E-Mail Removed)
http://www.nathansokalski.com/

"Edwin Knoppert" <(E-Mail Removed)> wrote in message
news:dn7m6e$n11$(E-Mail Removed)...
> Thanks, will take a peek tomorrow
>
> It's a bit odd though, both types support tranparancy.
> So some conversion unit could 'know' what get's transparent (imo).
> Conversion to plain BMP first is prob.not ok.
> However dotnet has a maketransparent method, and i was hoping this would
> work at least.
> I did not see any difference.
>
> But hey.. what do i know?
>
>
> "Nathan Sokalski" <(E-Mail Removed)> schreef in bericht
> news:eaW0oQ3%(E-Mail Removed)...
>> Making an image transparent in .NET is a rather complicated process,
>> which I don't quite understand. Here is a page that I was referred to by
>> someone in a newsgroup which is supposed to work. It is written in C#. I
>> am a VB.NET coder, and I couldn't get it to work in that, but I think
>> that is due to the unmanaged code capabilities of C#. I have not tried
>> the code in C#, so I am assuming it would work if I did it in C#. See
>> what it does for you. (If you do figure out a way to get it to work in
>> VB.NET, could you let me know?) Here is the URL:
>>
>> http://ewbi.blogs.com/develops/2005/...klines_22.html
>>
>> Good Luck!
>> --
>> Nathan Sokalski
>> (E-Mail Removed)
>> http://www.nathansokalski.com/
>>
>> "Edwin Knoppert" <(E-Mail Removed)> wrote in message
>> news:4396deba$0$2342$(E-Mail Removed)...
>>> That would not work but..
>>>
>>> i already converted to bmp and i used that code.
>>> But the backcolor remains black while i added:
>>> Dim bmp As Bitmap = ico.ToBitmap
>>> bmp.MakeTransparent(Color.Black)
>>> Return bmp
>>>
>>> The image remains the same though.
>>> Better see a real example with a transparent ico > gif.
>>>
>>> Your suggestion:
>>> For the type i used: x.ConvertTo(ico, bmp.GetType)
>>> But i don't know what to use to draw to user, and even to expect a
>>> transparent gif since i still use a bitmap object (GIF is bitmap so i
>>> should give it a chance).
>>>
>>> Currently the BMP is shown:
>>> Response.ContentType = "image/gif"
>>> Dim xx As System.Drawing.Imaging.ImageFormat
>>> ' send the image to the viewer
>>> bmp.Save(Response.OutputStream, xx.Gif)
>>>
>>> bmp.Dispose()
>>> Response.End()
>>>
>>>
>>>
>>> "Daniel Fisher(lennybacon)" <(E-Mail Removed)> schreef in bericht
>>> news:Olcg11y%(E-Mail Removed)...
>>>> Have you tried typeof(Bitmap) ?
>>>>
>>>> --
>>>> Daniel Fisher(lennybacon)
>>>> http://www.lennybacon.com
>>>>
>>>>
>>>> "Edwin Knoppert" <(E-Mail Removed)> wrote in message
>>>> news:4396d335$0$2340$(E-Mail Removed)...
>>>>> I'm trying to convert an icon handle to GIF.
>>>>>
>>>>> Something like:
>>>>> Public Function GetImageFromIconHandle(ByVal hIcon As Int32) As Int32
>>>>> Dim ico As Icon = Icon.FromHandle(hIcon)
>>>>> Dim x As New Drawing.IconConverter
>>>>> 'x.ConvertTo(ico,typeof(System.Drawing.Imaging.ImageFormat.Gif) )
>>>>> End Function
>>>>>
>>>>> x.ConvertTo(ico, <requires a system.type> )
>>>>>
>>>>> I don't know how to do that.
>>>>> Important is that a transparent icon should remain transparent.
>>>>>
>>>>> hIcon is a valid 16x16 icon.
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
ABBSoft Team
Guest
Posts: n/a
 
      29th Dec 2005
Try abbicon pro
http://www.abbsoft.com/abbiconpro

create icons from images in 27 formats. supports make icon transparent.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Having favicon.ico instead of IE.ico on a website Patrick Olurotimi Ige Microsoft ASP .NET 1 9th Dec 2004 03:27 PM
Displaying .ico files as an icon johnf Windows XP Help 2 12th Apr 2004 01:44 AM
*.Ico files look like default windows icon KenKnightJack Windows XP Help 1 21st Feb 2004 12:49 AM
icon.exe or ico.exe Jeff Windows XP Performance 0 27th Dec 2003 05:38 PM
.ico files broken Dan Overlander Windows XP General 0 9th Oct 2003 08:54 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:26 AM.