"Cor" <no*@non.com> wrote in message news:<O#******* *******@TK2MSFT NGP10.phx.gbl>. ..
Hi John,
I never made a png file, but in the link I gave you I see this code,
I see it nowhere in your code ????
<<snip>> // Get the CLSID of the PNG encoder.
GetEncoderClsid (L"image/png", &encoderClsi d);
stat = image->Save(L"Bird.pn g", &encoderClsi d, NULL);
Thanks for your reply, however the example is odd because there is no
Save method for images which uses the Encoder Clsid.
Using 3 of the available Bitmap Save methods, makes no difference to
the output png file. The 3 methods are shown below. Test1.png, 2 and
3 are exactly the same.
Private Sub createPng
Dim strGifs(3) As String
Dim i, pos(3, 1) As Integer
Dim oBmpPng As Bitmap
Dim oGraphics As Graphics
Dim oImgTile As Image
Dim pngFormat As ImageFormat
Dim pngGuid As Guid
Dim pngCodec As ImageCodecInfo
Dim encoderParams As EncoderParamete rs
pngCodec = GetEncoder("ima ge/png")
pngFormat = ImageFormat.Png
'Creates a 400 x 400 pixel Png file containing 4 Gifs. Each
Gif is 200 x 200
strGifs(0) = "TQ09NW04.g if"
strGifs(1) = "TQ09NW08.g if"
strGifs(2) = "TQ09NW24.g if"
strGifs(3) = "TQ09NW28.g if"
pos(0, 0) = 0 : pos(0, 1) = 0
pos(1, 0) = 0 : pos(1, 1) = 200
pos(2, 0) = 200 : pos(2, 1) = 0
pos(3, 0) = 200 : pos(3, 1) = 200
oBmpPng = New Bitmap(400, 400, PixelFormat.For mat32bppRgb)
oGraphics = Graphics.FromIm age(oBmpPng)
For i = 0 To 3
oImgTile = Image.FromFile( strFolder + strGifs(i))
oGraphics.DrawI mage(oImgTile, pos(i, 0), pos(i, 1))
Next
oBmpPng.Save(st rFolder + "test1.png" )
oBmpPng.Save(st rFolder + "test2.png" , pngCodec, encoderParams)
oBmpPng.Save(st rFolder + "test3.png" , pngFormat)
oBmpPng.Dispose ()
oGraphics.Dispo se()
oImgTile.Dispos e()
End Sub
Private Function GetEncoder(ByVa l mimeType As String) As
Imaging.ImageCo decInfo
Dim encoders() As Imaging.ImageCo decInfo =
Imaging.ImageCo decInfo.GetImag eEncoders()
Dim i As Integer
For i = 0 To encoders.Length - 1
If encoders(i).Mim eType = mimeType Then
Return encoders(i)
End If
Next
End Function