Bild in Bild Speichern(+als Hintergrund setzten)

  • Hi Leutz,

    Wie ich in der Themenüberschrift schon gesagt möchte ich ein Bild in einem Bild speichern.
    Die Bilder sind beide im BMP Format.

    Ich hab mir schon alles was zu GDIPlus in der Hilfe stand durchgelesen aber nix passendes gefunden
    und SuFu hab ich auch benutzt, naja hoffe ihr wisst was.

    Mfg. Keyle

  • Moin Leutz

    Hab probiert und probiert, es aber nich hingekriegt
    wo ist nur mein Fehler ?(

    Spoiler anzeigen
    [autoit]

    _GDIPlus_Startup()
    $InBild = _GDIPlus_ImageLoadFromFile(@DesktopCommonDir&"\sign.bmp")
    $ToBild = _GDIPlus_ImageLoadFromFile(_GetDeskWallpaper())
    $iX = _GDIPlus_ImageGetWidth ($InBild)
    $iY = _GDIPlus_ImageGetHeight ($InBild)
    $iX2 = _GDIPlus_ImageGetWidth ($ToBild)
    $iY2 = _GDIPlus_ImageGetHeight ($ToBild)
    $a=_GDIPlus_GraphicsDrawImage ($InBild,$ToBild,$iX-$iX2,$iY-$iY2)
    $b=_GDIPlus_ImageSaveToFile($ToBild,@DesktopCommonDir&"\sign2.bmp")
    _GDIPlus_ImageDispose($InBild)
    _GDIPlus_ImageDispose($ToBild)
    _GDIPlus_Shutdown()

    [/autoit] [autoit][/autoit] [autoit]

    Func _GetDeskWallpaper() ;==> Findet Pfad zum aktuellen Hintergrundbild
    Local $Filename = DllStructCreate("char[256]")
    DllCall("user32.dll", "long", "SystemParametersInfo" , "long", $SPI_GETDESKWALLPAPER , "long", 255 , "ptr", DllStructGetPtr($Filename) , "long", 0 )
    Return DllStructGetData($Filename, 1)
    EndFunc

    [/autoit]

    Mfg. Keyle

  • Ok das mit dem Bild im Bild hab ich jetzt

    thx @ GTASPIDER

    aber jetzt kommt mein 2. Problem.
    ich kann wenn ich das Bild speichere es nich als Hintergrund machen ;( , mit anderen Bildern Klappts einwandfrei
    Wo ist nur mein Fehler ?(

    Spoiler anzeigen
    [autoit]

    #include <GDIPlus.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $SPIF_UPDATEINIFILE = 0x01
    Global Const $SPIF_SENDWININICHANGE = 0x02
    Global Const $SPI_SETSCREENSAVEACTIVE = 0x11
    Global Const $SPI_SETDESKWALLPAPER = 0x14
    Global Const $SPI_GETDESKWALLPAPER = 0x73

    If $cmdline[0] > 0 Then
    If $cmdline[1] = "/so" Then
    _Sign()
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    Else
    If MsgBox(36, "Metin2 Sign", "Soll das Sign bei jedem Neustart aktualisiert werden?") = 6 Then _
    RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "Metin2Sign", "REG_SZ", '"' & @ScriptFullPath & '" /so')
    _Sign()
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    Func _Sign()
    InetGet("http://metin2-sigcreator.ath.cx/2_Keyle_3_1_4_SpeedCore_sig.png", @DesktopDir & "\sign.png")
    _GDIPlus_Startup()
    $Bild = _GDIPlus_ImageLoadFromFile(@DesktopDir & "\sign.png")
    _GDIPlus_ImageSaveToFile($Bild, @DesktopDir & "\sign.bmp")
    _GDIPlus_ImageDispose($Bild)
    _GDIPlus_Shutdown()
    FileDelete(@DesktopDir & "\sign.png")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_Startup()
    $InBild = _GDIPlus_ImageLoadFromFile(@DesktopDir&"\sign.bmp")
    $ToBild = _GDIPlus_ImageLoadFromFile(_GetDeskWallpaper())
    $ToBild2 = _GDIPlus_ImageGetGraphicsContext ($ToBild)
    $iX = _GDIPlus_ImageGetWidth ($InBild)
    $iY = _GDIPlus_ImageGetHeight ($InBild)
    $iX2 = _GDIPlus_ImageGetWidth ($ToBild)
    $iY2 = _GDIPlus_ImageGetHeight ($ToBild)
    $a=_GDIPlus_GraphicsDrawImage ($ToBild2,$InBild,$iX2-$iX,$iY2-$iY)
    $b=_GDIPlus_ImageSaveToFile($ToBild,@DesktopDir&"\sign2.bmp")
    _GDIPlus_ImageDispose($InBild)
    _GDIPlus_ImageDispose($ToBild)
    _GDIPlus_ImageDispose($ToBild2)
    _GDIPlus_Shutdown()
    MsgBox(0,"",$b) ;==> Prüft ob geklappt hat
    RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop", "TileWallpaper", "REG_SZ", "0")
    RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop", "WallpaperStyle", "REG_SZ", "0")
    _SetDeskWallpaper( @DesktopDir & "\sign2.bmp" )

    [/autoit] [autoit][/autoit] [autoit]

    EndFunc ;==>_Sign
    Func _SetDeskWallpaper($Filename)
    DllCall("user32.dll", "long", "SystemParametersInfo" _
    , "long", $SPI_SETDESKWALLPAPER _
    , "long", 0 _
    , "str", $Filename _
    , "long", BitOR($SPIF_UPDATEINIFILE, $SPIF_SENDWININICHANGE) _
    )
    EndFunc ;==>_SetDeskWallpaper

    [/autoit] [autoit][/autoit] [autoit]

    Func _GetDeskWallpaper()
    Local $Filename = DllStructCreate("char[256]")
    DllCall("user32.dll", "long", "SystemParametersInfo", "long", $SPI_GETDESKWALLPAPER, "long", 255, "ptr", DllStructGetPtr($Filename), "long", 0)

    [/autoit] [autoit][/autoit] [autoit]

    Return DllStructGetData($Filename, 1)
    EndFunc ;==>_GetDeskWallpaper

    [/autoit]

    Edit: Ups hab grad gemerkt es gaht ja doch nur das bild is Zentriert und nich gestreckt :P. jetzt muss ich das nur noch gestreckt krigen

    Auf den Bildern funktioniert es ja (siehe Anhang)

    Mfg. Keyle