getimage

command module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 11, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0

README

getimage

A Go program to fetch random images. Good if you're developing something where you need some images to test with.

Uses pexels.com . You'll need to get an api key from them and set an env var PEXELS_API_KEY with that value.

The app will pick a random image chosen from a number of random search terms. But you can specify your own search term.

Alternately, you can specify the URL of an image to download directly.

Images will be saved as image.png in the current directory, but you can specify an alternate image and file type.

Images will be resized to 800x800 pixels, but you can specify a width and/or height.

I've added some command line parameters to affect the image you get.

-w the width of the saved image (default: 800px)
-h the height of the saved image (default: 800px)
-g geometry of image defined was `widthxheight` - overrides w and h if set
-s a search term for the kind of image to download
-u a direct URL to an image - will bypass search, download and resize image
-o the output file name. extension can be any valid image type (default: "image.png")

Dependencies:

  • ImageMagick must be installed for the conversion and resizing.

Install:

If you have Go installed...

go install codeberg.org/bit101/getimage@latest

Or check out the code and build with Go.

Developed in Linux.

Installation and functionality tested in Linux, MacOS and Windows.

Documentation

Overview

Package main renders an image or video

Directories

Path Synopsis
Package imgutils ...
Package imgutils ...

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL