Skip to content

Image library for converting to files, streams, windows, base64, urls, cursors, screen coordinates, clipboard, pointers, handles, and more. Supports AutoHotkey v1 and v2.

License

Notifications You must be signed in to change notification settings

anonymous1184/ImagePut

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ImagePut

A core library for images in AutoHotkey

  • Screen capture with fast PixelSearch and ImageSearch
  • Decipher over 20+ image types
  • Convert from one image format to another
  • View and debug your image functions with ImagePutWindow(image)
  • The magical image parameter supports all image types through type inference
  • Highly robust code that has undergone extensive testing

Documentation

Sample Projects:

So you want to convert an image?

But you don't know how. That's okay because you can just do this:

str := ImagePutBase64("cats.jpg")

or this

ImagePutClipboard("https://example.com/cats.jpg")

or something like this:

pStream := ImagePutStream([0, 0, A_ScreenWidth, A_ScreenHeight])

Working with images should be this easy. ImagePut has automatic type inference, meaning that it will guess whether the input is (1) a file (2) a website url or (3) a series of coordinates that map to the screen. This functionality enables the user to only memorize a single function for any possible input. For a full list of supported input types, click on the documentation link here. For output types click here.

Convert file formats.

; Saves a JPEG as a GIF. 
ImagePutFile("cats.jpg", "gif")

Convert file formats and image types at the same time!

; Saves a JPEG as a base64 encoded GIF. 
str := ImagePutBase64("cats.jpg", "gif")

There's also some weird functions like ImagePutCursor which lets you set anything as your cursor. Make sure you don't choose an extremely large image!

Finally, there are several advanced features. The first is the ability to specify the input type directly. The second is cropping and scaling functionality. Third is use of ImageEqual() a function that can compare multiple inputs across different windows image data types!

; Declare input type as file.
ImagePutWindow({file: "cats.jpg"})

; Scale 2x and crop 10% from each edge.
ImagePutWindow({file: "cats.jpg", scale: 2, crop:["-10%", "-10%", "-10%", "-10%"]})

; Unknown image type declared as "image" to be cropped to 200x200 pixels. 
ImagePutWindow({image: "cats.jpg", crop: [0, 0, 200, 200]})

; Compare a url to a file.
MsgBox % ImageEqual("https://example.com/cats.jpg", "cats.jpg")

; Validate an image as an actual image.
ImageEqual("cats.jpg")

Design Philosophy

  • ImagePut is designed to be fast.
  • Only functions to and from streams, bitmaps are considered.
  • Specific functions between formats like PNG to hIcon are not considered.
  • ImagePut should serve as a reference implementation.
  • Therefore users should be able to copy and paste individual functions.
  • If you need help extracting a function please ask!

Help and Support

Feel free to ask for any help, questions, or post suggestions, etc.

About

Image library for converting to files, streams, windows, base64, urls, cursors, screen coordinates, clipboard, pointers, handles, and more. Supports AutoHotkey v1 and v2.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • AutoHotkey 96.1%
  • C 3.9%