Git Product home page Git Product logo

icongenerator's Introduction

Traffic Info

GitHub stars GitHub watchers GitHub forks GitHub contributors GitHub all releases GitHub release date GitHub last commit

Repo

GitHub repo size GitHub code size GitHub language count GitHub top language Coverage GitHub contributors GitHub license

Issues

GitHub issues GitHub closed issues GitHub pull requests GitHub closed pull requests

Unsplash Image Fetcher

This script fetches images from Unsplash based on a user-provided theme, resizes them to 64x64 pixels, and saves them to a directory. It also provides an option to only fetch images that have an equal aspect ratio. After fetching and saving the original images, the script converts them to grayscale with high contrast and saves them to a different directory.

Prerequisites

  • Python 3.6 or higher
  • The following Python packages: PIL, requests, termcolor
  • An Unsplash Access Key

Setup

  1. Clone this repository.

  2. Install the required Python packages using pip:

    pip install pillow requests termcolor
  3. Replace UNSPLASH_ACCESS_KEY in main.py with your Unsplash Access Key.

Usage

Run main.py:

python main.py

When prompted, enter a theme. The script will fetch images based on this theme from Unsplash, resize them to 64x64 pixels, and save them to the 'app/src/icons/{theme}/Base' directory. It will then convert the images to grayscale with high contrast and save them to the 'app/src/icons/{theme}/HighContrast' directory.

Configuration
You can modify the config dictionary in the main function in main.py to change the script's behavior. Currently, the only configuration option is match_aspect_ratio, which determines whether the script should only fetch images that have an equal aspect ratio. Set it to True to only fetch square images, or False to fetch images of any aspect ratio.

This README provides a brief description of the program, instructions for setting up and running the program, and information about the program's configuration options. You can add more sections as needed, such as a section for contributing guidelines or a section for license information.

Operations

  1. The program starts by executing the main function.

  2. The main function first sets up a configuration dictionary. Currently, the only configuration option is match_aspect_ratio, which is set to False by default. This means that by default, the program will fetch images of any aspect ratio.

  3. The main function then calls prompt_user_for_theme to prompt the user to enter a theme. The entered theme is returned and stored in the theme variable.

  4. The main function calls fetch_images_from_unsplash with the entered theme and the configuration dictionary. This function fetches images from Unsplash based on the theme and configuration, resizes them to 64x64 pixels, and returns them as a list of PIL Image objects.

  5. The main function calls save_icons_to_directory with the list of images, the theme, and the prefix "Base". This function saves the images to the 'app/src/icons/{theme}/Base' directory.

  6. The main function converts each image in the list to grayscale with high contrast by calling convert_to_grayscale_and_contrast in a list comprehension. The grayscale images are stored in a new list.

  7. The main function calls save_icons_to_directory again, this time with the list of grayscale images, the theme, and the prefix "HighContrast". This function saves the grayscale images to the 'app/src/icons/{theme}/HighContrast' directory.

  8. The program ends after the main function finishes executing.

icongenerator's People

Contributors

makaminski avatar

Watchers

 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.