Skip to content

Quick Start

Edison Hua edited this page Jan 27, 2024 · 72 revisions

Getting the Latest Version (Method #1)

  1. Download a copy of the repository as a zip file.
  2. Extract.
  3. Double click demo.ahk. Choose whichever version of AutoHotkey you prefer. You should see the following dancing GIF. Right click the GIF to close. (It's a bit tricky since there are transparent frames.)

cute anime girl dancing.gif

Stable Release (Method #2)

Download the latest stable release here: https://github.com/iseahound/ImagePut/releases

Copy the script file (Method #3)

    1. AutoHotkey v1: Save and rename this file as ImagePut.ahk
    2. AutoHotkey v2: Download this file as ImagePut.ahk
  1. Create a new AutoHotkey script in the same directory as ImagePut.ahk

#Include *i ImagePut.ahk          ; Rename from ImagePut (for v1).ahk
#Include *i ImagePut (for v1).ahk ; If you forgot to rename it

; Show an image from url
hwnd := ImageShow("https://picsum.photos/200")

; Press Win + c to capture screen to file
#c:: filepath := ImagePutFile(0)  ; , ImageShow(filepath)

; Capture the current window and save it to desktop and clipboard.
#s:: ImagePutClipboard(ImagePutFile("A", A_Desktop))
  1. Run the above script. You should see a randomly generated image on screen. Press Win + c or Win + s to activate the hotkeys.

Overview list:

Accepts:

  • base64
    • URI
  • bitmap (pBitmap)
  • buffer
    • ptr, stride, height
    • ptr, width, height
    • ptr, size, stride
    • ptr, size, width
    • ptr, size, height
  • clipboard
    • CF_BITMAP
    • CF_DIB
    • CF_DIBV5
    • png
    • gif (implemented, not activated)
  • cursor
  • dc
  • desktop
  • file
    • bmp, dib, rle
    • jpg, jpeg, jpe, jfif
    • gif
    • emf (read only)
    • wmf (read only)
    • tif, tiff
    • png
    • ico (read only)
    • heic, hif
    • webp (read only)
  • hbitmap
  • hex
  • hicon
  • hwnd
  • monitor
  • object
    • .pBitmap
    • .hwnd
    • .ptr
  • pdf
    • file
    • url
  • randomaccessstream
  • screenshot
    • [x, y, w, h]
    • [x, y, w, h, window] - Relative to a window
  • stream
    • IStream
    • IWICStream
    • MemoryStream
    • FileStream
    • Anything that inherits from IStream
  • sprite
    • file
    • url
  • url
  • wallpaper
  • wicbitmap
    • Only certain 32-bit compatible formats
  • window
    • A - Current Active Window
    • window title
    • ahk_id
    • ahk_class
    • ahk_exe
    • ahk_pid
    • ahk_group
    • Any combination of the above
    • hwnd

Supported encodings / compression formats are listed under file.

Known Issue: If there is a file and window with the same name, the file will always be resolved first. Use ImageShow({window: MyHwnd}) to select the window.

Complete Function List

Extra Functions:

  • ImageShow(image, title, pos, style, styleEx, parent) - Basically shows the image without the window border. Great for animated GIFs.
  • ImageWidth(image)
  • ImageHeight(image)
  • ImageDestroy(image) - Cleans up the effects of any of the above output functions. Pass in the return values to destroy the image.
  • ImageEqual(images*) - Compare any number of images.