Git Product home page Git Product logo

img's Introduction

img

A command-line program to view multiple image files.

Prerequisites

Installation

  1. Clone the repository: git clone https://github.com/4cecoder/img.git
  2. Build the program: sh build.sh
  3. Install the program: sudo make clean install or sudo ./install.sh

Usage

To start the program, run: img . to cycle through images in the current directory

Or specify a full directory path: img ~/Pictures/

Controls

  • J and K keys to cycle through images
  • Press Q to quit

Contributing

Contributions are welcome! Please submit a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

img's People

Contributors

4cecoder avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

npmaile

img's Issues

quality of life golang branch

walk through the files
oh no use flag package and NOT os.args

use mime type package instead of playing weird games with ext names

use fyne and FORGET GTK

@npmaile thx nate

images path needs to be relative

To ensure the program can work after being installed in /usr/local/bin/ on Linux and is able to look at the directory the user is in, you can modify the program to take an optional command line argument specifying the directory to load images from. If no argument is provided, the program will load images from the current working directory.

User's now need to specify the path after img command is used, like this:
img /path/to/images

new main code:

int main(int argc, char** argv) {
  char* dir_path = ".";
  if (argc > 2) {
    g_print("Usage: %s [directory]\n", argv[0]);
    return EXIT_FAILURE;
  } else if (argc == 2) {
    dir_path = argv[1];
  }

  load_images(dir_path);

  gtk_init(&argc, &argv);

  GtkWidget* window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  gtk_window_set_title(GTK_WINDOW(window), "Image Viewer");
  gtk_window_set_default_size(GTK_WINDOW(window), 300, 300);
  gtk_container_set_border_width(GTK_CONTAINER(window), 10);
  gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
  g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL);

  image = gtk_image_new_from_pixbuf(pixbuf[current_image]);
  gtk_container_add(GTK_CONTAINER(window), image);

  g_signal_connect(window, "key-press-event", G_CALLBACK(on_key_press), NULL);

  gtk_widget_show_all(window);

  gtk_main();

  for (int i = 0; i < total_images; i++) {
    g_object_unref(pixbuf[i]);
  }

  return EXIT_SUCCESS;
}

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.