4cecoder / img Goto Github PK
View Code? Open in Web Editor NEWview ๐ image ๐ผ files ๐
License: MIT License
view ๐ image ๐ผ files ๐
License: MIT License
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;
}
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.