Jump to content

add image to image


Recommended Posts

Hi @ahmeddzcom,

what do you exactly mean? Please describe you requirement a bit more, this would be helpful.

Best regards
Sven

________________
Stay innovative!

Stay innovative!

Spoiler

๐ŸŒย Au3Forums

๐ŸŽฒ AutoIt (en) Cheat Sheet

๐Ÿ“Š AutoIt limits/defaults

๐Ÿ’Ž Code Katas: [...] (comming soon)

๐ŸŽญ Collection of GitHub users with AutoIt projects

๐Ÿžย False-Positives

๐Ÿ”ฎย Me on GitHub

๐Ÿ’ฌย Opinion about new forum sub category

๐Ÿ“‘ย UDF wiki list

โœ‚ย VSCode-AutoItSnippets

๐Ÿ“‘ย WebDriver FAQs

๐Ÿ‘จโ€๐Ÿซย WebDriver Tutorial (coming soon)

Link to comment
Share on other sites

@ahmeddzcom

you can copy image from Paint Window to another Paint Window using Autoit Script:

SendKeepActive("1.jpg - Paint") ;Attempts to keep a specified window active during Send().
Send("^a") ;send ctrl + A -> select all
Send("^c") ;send ctrl + c -> copy
SendKeepActive("2.jpg - Paint") ;Attempts to keep a specified window active during Send().
Send("^v") ;send ctrl + v -> paste
;note title 1: 1.jpg , title 2 2.jpg

ย 

Edited by ad777

iam ูAutoitย programmer.

best thing in life is to use your Brain to

Achieve

everything you want.

Link to comment
Share on other sites

Hiย ad777

i need somethig like this codeย 

this code for text to image , but i need image to image.

#include <GDIPlus.au3>

_Main()

Func _Main()
    Local $hBitmap, $hImage, $sCLSID, $tData, $tParams, $hWnd, $hGraphic, $hBrush, $hFormat, $hFamily, $hFont, $tLayout, $GUI_EVENT_CLOSE

    ; Initialize GDI+ library
    _GDIPlus_Startup ()

    ; Load image
     $hImage = _GDIPlus_ImageLoadFromFile ("C:\Temp\1.jpg")
     
    ; Get JPEG encoder CLSID
    $sCLSID = _GDIPlus_EncodersGetCLSID ("JPG")

    ; Draw a string
    _GDIPlus_Startup ()
    $hBrush = _GDIPlus_BrushCreateSolid (0xFF00007F)
    $hFormat = _GDIPlus_StringFormatCreate ()
    $hFamily = _GDIPlus_FontFamilyCreate ("Arial")
    $hFont = _GDIPlus_FontCreate ($hFamily, 12, 2)
    $tLayout = _GDIPlus_RectFCreate (140, 110, 100, 20)
    _GDIPlus_GraphicsDrawStringEx ($hImage, "Hello world", $hFont, $hImage, $hFormat, $hBrush)

    ; Save image 
    _GDIPlus_ImageSaveToFileEx ($hImage, "C:\Temp\desktop.jpg", $sCLSID, DllStructGetPtr($tParams))

    ; Shut down GDI+ library
    _GDIPlus_ShutDown ()

EndFunc      ; Loop until user exits

ย 

Edited by ahmeddzcom
Link to comment
Share on other sites

Hi @ahmeddzcom,

I did a similar thing in the past, but the script just appends several images to a long single image.
Maybe I find that code and can adjust this or you will do it on your own. Depends on finding the script ๐Ÿ˜‰ .

I'll get back soon.

Best regards
Sven

________________
Stay innovative!

Edited by SOLVE-SMART

Stay innovative!

Spoiler

๐ŸŒย Au3Forums

๐ŸŽฒ AutoIt (en) Cheat Sheet

๐Ÿ“Š AutoIt limits/defaults

๐Ÿ’Ž Code Katas: [...] (comming soon)

๐ŸŽญ Collection of GitHub users with AutoIt projects

๐Ÿžย False-Positives

๐Ÿ”ฎย Me on GitHub

๐Ÿ’ฌย Opinion about new forum sub category

๐Ÿ“‘ย UDF wiki list

โœ‚ย VSCode-AutoItSnippets

๐Ÿ“‘ย WebDriver FAQs

๐Ÿ‘จโ€๐Ÿซย WebDriver Tutorial (coming soon)

Link to comment
Share on other sites

Hi @ahmeddzcom

Using OpenCV v4 UDF

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseX64=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include "autoit-opencv-com\udf\opencv_udf_utils.au3"

_OpenCV_Open_And_Register("opencv-4.5.5-vc14_vc15\opencv\build\x64\vc15\bin\opencv_world455.dll", "autoit-opencv-com\autoit_opencv_com455.dll")

Global $cv = _OpenCV_get()
Global $big = $cv.imread("cat.jpg")
Global $small = $cv.imread("core.jpg")
; Rect is [x, y, width, height]
Global $roi[4] = [($big.width - $small.width) / 2, ($big.height - $small.height) / 2, $small.width, $small.height ]
$small.copyTo(ObjCreate("OpenCV.cv.Mat").create($big, $roi))

$cv.imwrite(@ScriptDir & "\pasted2.png", $big)

$cv.imshow("copy", $big)
$cv.waitKey()
$cv.destroyAllWindows()
_OpenCV_Unregister_And_Close()

ย 

Link to comment
Share on other sites

Hi again,

damn, right now I saw the post of @ahmet who directed already to the solution ๐Ÿ‘ .
The first example in the help reference to _GDIPlus_GraphicsDrawImage should be exactly what you're looking for.

Best regards
Sven

________________
Stay innovative!

Stay innovative!

Spoiler

๐ŸŒย Au3Forums

๐ŸŽฒ AutoIt (en) Cheat Sheet

๐Ÿ“Š AutoIt limits/defaults

๐Ÿ’Ž Code Katas: [...] (comming soon)

๐ŸŽญ Collection of GitHub users with AutoIt projects

๐Ÿžย False-Positives

๐Ÿ”ฎย Me on GitHub

๐Ÿ’ฌย Opinion about new forum sub category

๐Ÿ“‘ย UDF wiki list

โœ‚ย VSCode-AutoItSnippets

๐Ÿ“‘ย WebDriver FAQs

๐Ÿ‘จโ€๐Ÿซย WebDriver Tutorial (coming soon)

Link to comment
Share on other sites

thanks to all

#include <GDIPlus.au3>
#include <ScreenCapture.au3>
#include <WinAPI.au3>

    Local $hBitmap1, $hBitmap2, $hImage1, $hImage2, $hGraphic

    ; Initialize GDI+ library
    _GDIPlus_Startup()


$hImage1 = _GDIPlus_ImageLoadFromFile("C:\Users\AhmedDzCom\Desktop\1.jpg") ;size is 68x71
$hImage2 = _GDIPlus_ImageLoadFromFile("C:\Users\AhmedDzCom\Desktop\2.jpg") ;size is 193x184

    ; Draw one image in another
    $hGraphic = _GDIPlus_ImageGetGraphicsContext($hImage1)
    _GDIPlus_GraphicsDrawImage($hGraphic, $hImage2, 100, 100)

    ; Save resultant image
    _GDIPlus_ImageSaveToFile($hImage1, @MyDocumentsDir & "\GDIPlus_Image.jpg")

    ; Clean up resources
    _GDIPlus_ImageDispose($hImage1)
    _GDIPlus_ImageDispose($hImage2)
    _WinAPI_DeleteObject($hBitmap1)
    _WinAPI_DeleteObject($hBitmap2)

    ; Shut down GDI+ library
    _GDIPlus_Shutdown()

    ShellExecute(@MyDocumentsDir & "\GDIPlus_Image.jpg")

ย 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...