Git Product home page Git Product logo

imageput's Introduction

ImagePut

A core library for images in AutoHotkey

image

Imagine a scenario where you have a file but you're trying to get it uploaded into an API. Or you have a function that returns some strange image format, is there any way you can just get it to show its contents? If you pass anything, literally anything you believe is an image to ImagePutWindow() it will show up on screen. And then you can magically transform it to be compatible with that specific API.

Features

  • Simple and effective
  • Decipher over 20+ image types
  • Supports newer formats webp and heic
  • View and debug your image functions with ImagePutWindow(image)
  • Screen capture with fast PixelSearch and ImageSearch
  • Add animated GIFs to AutoHotkey GUIs
  • Upload images using website apis
  • Load images from blocks of memory

Beginner

Intermediate

Documentation

Tutorials

Misc

Advanced

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

  • 100% Compatibility with Gdip_All.ahk
  • ImagePut is designed to be the fastest
  • ImagePut should serve as a reference implementation
  • Specific conversions between formats like PNG file to hIcon are not considered
  • Users should be able to replace uses of ImagePut with individual functions
  • Therefore users should be 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.

imageput's People

Contributors

iseahound avatar wind0204 avatar tmplinshi avatar animan8000 avatar thecrether avatar anonymous1184 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.