Ver Mensaje Individual
  #1 (permalink)  
Antiguo 12/11/2008, 05:44
Mirador
 
Fecha de Ingreso: abril-2007
Mensajes: 82
Antigüedad: 18 años
Puntos: 0
[vb.net 2003] Unir imagenes

Buenas, estoy intentando unir verticalmente una serie de imagenes que etngo en una carpeta, para despues guardarlo como un bmp o jpg (me es indiferente).

Para ello cojo una imagen de 1x1px para tener una referencia de donde dibujarlo.

El problema es que a la hora de guardar la imagen, no me realiza los cambios (no aparecen las imagenes unidas) sino que sigue el archivo de 1x1px (pero la fecha de edicion del archivo si que cambia, asi que guardar guarda algo).

Dejo el codigo:

Código:
Dim i As Integer
        Dim axLayer As ESRI.MapObjects2.Core.MapLayer
        Dim img() As Bitmap
        Dim z As Integer = 0
        Dim imgFinal As Bitmap = Bitmap.FromFile("C:\aaa.bmp")
        Dim g As Graphics = Graphics.FromImage(imgFinal)
        Dim intHeigh As Integer = 0
        Try
            'Esto no tiene nada que ver con lo dicho, solo pongo visible un componente
            'del que voi a exportar las imagenes bmp a unir
            If Not Me.axLeyenda.Visible Then
                axLeyenda.setMapSource(AxMapa)
                axLeyenda.LoadLegend(True)
                axLeyenda.ShowAllLegend()
                axLeyenda.set_Active(0, True)
                sRedimensionarControles_VisualizarLeyenda()
            End If
            For i = 0 To Me.AxMapa.Layers.Count - 1
                axLayer = Me.AxMapa.Layers.Item(i)
                If axLayer.Visible Then                    
                    If fCheckLayerInMap(axLayer) Then
                        'Exporto la imagen del componente (solo si se cumplen unas condiciones
                        '(comprobado que se exportan correctamente)
                        Me.axLeyenda.ExportToBmp("C:\Borrame\" & i & ".bmp", i)
                        ReDim Preserve img(z)
                        img(z) = New Bitmap("C:\Borrame\" & i & ".bmp")
                        'Aqui lo dibujo
                        g.DrawImage(img(z), 0, intHeigh)
                        intHeigh = intHeigh + img(z).Height
                        z += 1
                    End If
                End If
            Next
           imgFinal.Save("C:\leyenda.bmp", Imaging.ImageFormat.Bmp)
        Catch ex As Exception
            MsgBox("Error: " & ex.Message & vbNewLine & "Traza: " & ex.StackTrace)
        Finally
            sRedimensionarControles_OcultarLeyenda()
            i = Nothing
            axLayer = Nothing
            img = Nothing
            z = Nothing
            g.Dispose()
            g = Nothing
            imgFinal = Nothing
            intHeigh = Nothing
        End Try