GithubHelp home page GithubHelp logo

iklone / 3x3gen Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 5.03 MB

3x3 image generator for MyAnimeList. Built with Python 3 and the Jikan.moe API

Python 100.00%
python anime manga myanimelist 3x3 image jikan jikanime jikan-moe

3x3gen's Introduction

3x3gen

A python generator for 3x3 composite images. Commonly used to collect and display a favourite list.

There are 3 scripts here:

  • 3x3.py: Compile 9 images into a 3x3 composite image. Details below.
  • jikan3x3.py: Grab data from a specified MyANimeList account and build a composite grid. Details below.
  • jikanman3x3.py: Uses a list pulled from a text file to build a grid using MAL images. Details below.

Requirements

For all scripts:

  • Python 3
  • PIL: pip install pil

For jikan3x3.py and jikanman3x3.py:

  • jikanpy: pip install jikanpy

3x3.py

Use

To use the program, place the 3x3.py file in a directory/folder with the 9 images you want to compile. Then run from command line with 2 arguments:

  1. Size: width/height in pixels, image is always square. (integer) (default 1000)
  2. Border: Grey value of the border. 0 for black, 255 for white. (integer) (default black)

Function

The program will order the images by filename and place the in the configuration:

1 2 3
4 5 6
7 8 9

Images other than the first 9 (alphabetically) in the directory will be ignored. Recognises .jpg, .jpeg and .png files.

Examples

3x3 using images in directory. 1000x1000 pixels and a black border (default) python 3x3.py

Image of 10000x10000 pixels with grey border: python 3x3.py 10000 128

jikan3x3.py

Use

Can be run anywhere, will generate image into current directory.

Arguments:

  1. Username: MAL username (string) REQUIRED
  2. Type: Type of favourite list: anime/manga/characters/people (string) {default anime)
  3. Datapool: Where the data is pulled from: fav/list (Fav pulls from the "favorites" section of your about page. list pulls from either your animelist or your mangalist). Manga/anime grids can use fav or list. Character/people grids MUST use fav. (string) (default fav)
  4. Matrix width: Width/Height of the grid. To build a 3x3 (9 total items) use 3. (integer) (default 3)
  5. Image width: Width of the output image in pixels. (integer) (default 1000)
  6. Border brightness: Grey value of the border. 0 for black, 255 for white (integer) (default black)

Function

The items will be placed into the grid in a random configuration.

If datapool = list, items will be placed in in order of "score". Sub-score order is randomised. For example, if running a 5x5 anime grid, but there are only 20 anime rated 10/10, 5 9/10 anime will be chosen at random to fill in the gaps.

While there is nothing preventing it, grids using datapool fav only have a pool size of 10. Therefore 3x3 grids are the maximum size fillable grids.

Examples

3x3 grid of user iklone's favourite characters: python3 jikan3x3.py iklone characters

8x8 grid of user iklone's top anime from his animelist: python3 jikan3x3.py iklone anime list 8

5x5 grid of user iklone's favourite people with a grey border on a 10000x10000 pixel image: python3 jikan3x3.py iklone people fav 5 10000 128

jikanman3x3.py

Use

Must be sent a plain text file containing the wanted anime, one per line without any blank lines. This file must be sent through the first argument.

Arguments:

  1. File: Directory of text file (directory) REQUIRED
  2. Title: Grid title. Will be inserted above grid on image. (string)
  3. Custom matrix size: Custom matrix width. Will be automatically calculated otherwise. (integer)
  4. Image width: Width of the output image in pixels. (integer) (default 1000)
  5. Border brightness: Grey value of the border. 0 for black, 255 for white (integer) (default black)

Function

The items order will be randomised, and then inserted into a grid. The size of the grid is eithe manually inputted or calculated from the floor of the square root of the number of items. This means that some items may be cut out if the given list's length isn't a square number. The items cut will be randomised each run.

The grid title requires a *.ttf file to be present in the directory. Find the truetype font of your choosing and place it into the directory you are running the script. The title's size and position is currently non-customisable. If you are having trouble here it may be easier to manually add the title afterwards in an image editor. The font I use is VCR OSD Mono Regular, and can be found online for free.

Examples

3x3 grid of "miyazaki.txt" with title "Miyazaki Anime". Since example.txt has 10 items, and 3^2=9, one item will be randomly cut. python3 jikanman3x3.py miyazaki.txt "Miyazaki Anime"

Using file "miyazaki.txt":

Spirited Away
Ponyo
Nausicaa
Panda Kopanda
Lupin III Cagliostro
Kiki's Delivery Service
Princess Mononoke
Future Boy Conan
Laputa
Totoro

3x3gen's People

Contributors

iklone avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

3x3gen's Issues

Can't generate a grid from any myanimelist accounts script returns 400 error

When I run jikan3x3 it returns an error. For example if I run:

python3 jikan3x3.py iklone anime list 8

It spots out:

jikanpy.exceptions.APIException: HTTP 400 - status=400, type=HttpException, message=Invalid or incomplete request. Please double check the request documentation, error=None for username=iklone, request=animelist

I tried it on multiple accounts as well. I am guessing myanimlist changed their API?

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.