DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Sat, 14 Jul 2007 20:07:19 -0400,    posted on: microsoft.public.dotnet.framework.drawing        back       

Thread Index
  1    active
          2    Bob Powell [MVP]
          3    active
          4    active
          5    Bob Powell [MVP]
          6    active
          7    active


How would you change the size of a Format8bppIndexed bitmap?   
I need to change the size of an Format8bppIndexed image.

I suppose I could change the format and scale it and put it back.

But I'm wondering if there is a more straight forward way.


How would you change the size of a Format8bppIndexed bitmap?


Thanks
Date:Sat, 14 Jul 2007 20:07:19 -0400   Author:  

Re: How would you change the size of a Format8bppIndexed bitmap?   
Changing the size will almost definitely result in changing the palette so 
the reults may be less than stellar.

I would load the image, Create a 24 bit image of the new size, draw the 8 
bit to the new image, calculate a new palette for the 24bit image and then 
save the new image as 8 bit using the new palette.

See the articles in the FAQ about GIF palettes.

-- 
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.



" active"  wrote in message 
news:OjfXmQnxHHA.276@TK2MSFTNGP06.phx.gbl...

>I need to change the size of an Format8bppIndexed image.
>
> I suppose I could change the format and scale it and put it back.
>
> But I'm wondering if there is a more straight forward way.
>
>
> How would you change the size of a Format8bppIndexed bitmap?
>
>
> Thanks
> 
Date:Sun, 15 Jul 2007 11:46:45 +0200   Author:  

Re: How would you change the size of a Format8bppIndexed bitmap?   
"Bob Powell [MVP]"  wrote in message 
news:OCt2VUsxHHA.4916@TK2MSFTNGP04.phx.gbl...

> Changing the size will almost definitely result in changing the palette so 
> the reults may be less than stellar.


Why wouldn't the original palette work OK? Won't the colors be very similar 
to the original?

Also, I wasn't clear. I don't need to save it, just display it. If that 
makes any difference to your answer. Can I simply convert the new image  to 
8-bits - how - I believe I can't draw it into an 8-bit bitmap?


thanks



>
> I would load the image, Create a 24 bit image of the new size, draw the 8 
> bit to the new image, calculate a new palette for the 24bit image and then 
> save the new image as 8 bit using the new palette.
>
> See the articles in the FAQ about GIF palettes.
>
> -- 
> Bob Powell [MVP]
> Visual C#, System.Drawing
>
> Ramuseco Limited .NET consulting
> http://www.ramuseco.com
>
> Find great Windows Forms articles in Windows Forms Tips and Tricks
> http://www.bobpowell.net/tipstricks.htm
>
> Answer those GDI+ questions with the GDI+ FAQ
> http://www.bobpowell.net/faqmain.htm
>
> All new articles provide code in C# and VB.NET.
> Subscribe to the RSS feeds provided and never miss a new article.
>
>
>
> " active"  wrote in message 
> news:OjfXmQnxHHA.276@TK2MSFTNGP06.phx.gbl...
>>I need to change the size of an Format8bppIndexed image.
>>
>> I suppose I could change the format and scale it and put it back.
>>
>> But I'm wondering if there is a more straight forward way.
>>
>>
>> How would you change the size of a Format8bppIndexed bitmap?
>>
>>
>> Thanks
>>
>
> 
Date:Sun, 15 Jul 2007 10:21:13 -0400   Author:  

Re: How would you change the size of a Format8bppIndexed bitmap?   
Displaying turned out to be simple.


" active"  wrote in message 
news:%23nD0wtuxHHA.3400@TK2MSFTNGP03.phx.gbl...

>
> "Bob Powell [MVP]"  wrote in message 
> news:OCt2VUsxHHA.4916@TK2MSFTNGP04.phx.gbl...
>> Changing the size will almost definitely result in changing the palette 
>> so the reults may be less than stellar.
>
> Why wouldn't the original palette work OK? Won't the colors be very 
> similar to the original?
>
> Also, I wasn't clear. I don't need to save it, just display it. If that 
> makes any difference to your answer. Can I simply convert the new image 
> to 8-bits - how - I believe I can't draw it into an 8-bit bitmap?
>
>
> thanks
>
>
>>
>> I would load the image, Create a 24 bit image of the new size, draw the 8 
>> bit to the new image, calculate a new palette for the 24bit image and 
>> then save the new image as 8 bit using the new palette.
>>
>> See the articles in the FAQ about GIF palettes.
>>
>> -- 
>> Bob Powell [MVP]
>> Visual C#, System.Drawing
>>
>> Ramuseco Limited .NET consulting
>> http://www.ramuseco.com
>>
>> Find great Windows Forms articles in Windows Forms Tips and Tricks
>> http://www.bobpowell.net/tipstricks.htm
>>
>> Answer those GDI+ questions with the GDI+ FAQ
>> http://www.bobpowell.net/faqmain.htm
>>
>> All new articles provide code in C# and VB.NET.
>> Subscribe to the RSS feeds provided and never miss a new article.
>>
>>
>>
>> " active"  wrote in message 
>> news:OjfXmQnxHHA.276@TK2MSFTNGP06.phx.gbl...
>>>I need to change the size of an Format8bppIndexed image.
>>>
>>> I suppose I could change the format and scale it and put it back.
>>>
>>> But I'm wondering if there is a more straight forward way.
>>>
>>>
>>> How would you change the size of a Format8bppIndexed bitmap?
>>>
>>>
>>> Thanks
>>>
>>
>>
>
> 
Date:Sun, 15 Jul 2007 19:53:43 -0400   Author:  

Re: How would you change the size of a Format8bppIndexed bitmap?   
Under GDI+ new 8bpp images are assigned a "spread palette" which is a 
palette that simply contains a selection of common colours that are supposed 
to suit all images but in reality is a bad choice for almost all images.

You can almost guarantee that the original palette will be unusable because 
the index mappings will depend entirely on the algorithm used to generate 
the dedicated palette.

It is therefore a laborious process as I outlined.

-- 
-- 
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.


" active"  wrote in message 
news:%23nD0wtuxHHA.3400@TK2MSFTNGP03.phx.gbl...

>
> "Bob Powell [MVP]"  wrote in message 
> news:OCt2VUsxHHA.4916@TK2MSFTNGP04.phx.gbl...
>> Changing the size will almost definitely result in changing the palette 
>> so the reults may be less than stellar.
>
> Why wouldn't the original palette work OK? Won't the colors be very 
> similar to the original?
>
> Also, I wasn't clear. I don't need to save it, just display it. If that 
> makes any difference to your answer. Can I simply convert the new image 
> to 8-bits - how - I believe I can't draw it into an 8-bit bitmap?
>
>
> thanks
>
>
>>
>> I would load the image, Create a 24 bit image of the new size, draw the 8 
>> bit to the new image, calculate a new palette for the 24bit image and 
>> then save the new image as 8 bit using the new palette.
>>
>> See the articles in the FAQ about GIF palettes.
>>
>> -- 
>> Bob Powell [MVP]
>> Visual C#, System.Drawing
>>
>> Ramuseco Limited .NET consulting
>> http://www.ramuseco.com
>>
>> Find great Windows Forms articles in Windows Forms Tips and Tricks
>> http://www.bobpowell.net/tipstricks.htm
>>
>> Answer those GDI+ questions with the GDI+ FAQ
>> http://www.bobpowell.net/faqmain.htm
>>
>> All new articles provide code in C# and VB.NET.
>> Subscribe to the RSS feeds provided and never miss a new article.
>>
>>
>>
>> " active"  wrote in message 
>> news:OjfXmQnxHHA.276@TK2MSFTNGP06.phx.gbl...
>>>I need to change the size of an Format8bppIndexed image.
>>>
>>> I suppose I could change the format and scale it and put it back.
>>>
>>> But I'm wondering if there is a more straight forward way.
>>>
>>>
>>> How would you change the size of a Format8bppIndexed bitmap?
>>>
>>>
>>> Thanks
>>>
>>
>>
>
> 
Date:Sun, 22 Jul 2007 15:27:41 +0200   Author:  

Re: How would you change the size of a Format8bppIndexed bitmap?   

>> "Bob Powell [MVP]"  wrote in message
>> news:OCt2VUsxHHA.4916@TK2MSFTNGP04.phx.gbl...
...snip
>>> I would load the image, Create a 24 bit image of the new size, draw the 
>>> 8 bit to the new image, calculate a new palette for the 24bit image and 
>>> then save the new image as 8 bit using the new palette.
>>>



The following is what I've done so far.

I haven't yet looked into calculating a new palette (if needed).

I could sure use your comments!



mGifImage = Image.FromFile(dlg.FileName)

Dim newBitmap As Bitmap = New Bitmap(200, 200, PixelFormat.Format24bppRgb)

'Is newBitmap palette "spread palette" ?



Dim gr As Graphics = Graphics.FromImage(newBitmap)

gr.DrawImage(mGifImage, 0, 0, 200, 200)

'Is newBitmap palette from mGifImage or  spread palette?



Dim ms As New MemoryStream()

newBitmap.Save(ms, ImageFormat.Gif)

'is ms palette  newBitmap palette or created?



ms.Seek(0, SeekOrigin.Begin)

Dim outReader As BinaryReader = New BinaryReader(ms)

Dim newBitmap2 As Bitmap = New Bitmap(ms)

'is newBitmap2 palette from ms or spread palette?
Date:Mon, 23 Jul 2007 21:58:45 -0400   Author:  

Re: How would you change the size of a Format8bppIndexed bitmap?   
"Bob Powell [MVP]"  wrote in message 
news:OCt2VUsxHHA.4916@TK2MSFTNGP04.phx.gbl...

> Changing the size will almost definitely result in changing the palette so 
> the reults may be less than stellar.
>
> I would load the image, Create a 24 bit image of the new size, draw the 8 
> bit to the new image, calculate a new palette for the 24bit image


>and then  save the new image as 8 bit using the new palette.
>
> See the articles in the FAQ about GIF palettes.
>

Bob,
I thought you'd like to know that the link in the following page is not good 
any more.
Maybe it'll come back but I figured it best to pass the info on.
http://www.bobpowell.net/colourquantization.htm

I've been looking for code to calculate the new palette - if I find some 
I'll pass it on.




> -- 
> Bob Powell [MVP]
> Visual C#, System.Drawing
>
> Ramuseco Limited .NET consulting
> http://www.ramuseco.com
>
> Find great Windows Forms articles in Windows Forms Tips and Tricks
> http://www.bobpowell.net/tipstricks.htm
>
> Answer those GDI+ questions with the GDI+ FAQ
> http://www.bobpowell.net/faqmain.htm
>
> All new articles provide code in C# and VB.NET.
> Subscribe to the RSS feeds provided and never miss a new article.
>
>
>
> " active"  wrote in message 
> news:OjfXmQnxHHA.276@TK2MSFTNGP06.phx.gbl...
>>I need to change the size of an Format8bppIndexed image.
>>
>> I suppose I could change the format and scale it and put it back.
>>
>> But I'm wondering if there is a more straight forward way.
>>
>>
>> How would you change the size of a Format8bppIndexed bitmap?
>>
>>
>> Thanks
>>
>
> 
Date:Sun, 29 Jul 2007 13:25:25 -0400   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us