Python Code for downloading images from Gatherer
by mtgrares
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
Python Code for downloading images from Gatherer
by Rajarshi » 26 Aug 2016, 15:12
Hi, everyone.
I have written this small python code to directly download images from Gatherer. With this script, Forge will not need any image URLs. The script automatically assigns the ".full.jpg" to the images. If the images are in PNG format, this script also invokes Mogrify from Bash to change them in Bash into JPG. However, you will need the Imagemagik package to do this. (the command is
The script automatically obtains the names of the cards by searching the Gatherer database, so there is no need to use any special database to store card names for images. What you need to do is enter the full string of the set name, the format (jpg/png) in which the images are stored, the number of pages in Gatherer's listing of cards in that set (simply enter the set in Gatherer and leave all other fields blank, and check how many pages there are; leave this blank if you are not sure) and Bang! The script will start downloading images one after the other.
This is only a preliminary version, and can only run on Linux and must be invoked via command line. I am trying to improve this by implementing the following changes:
[*] Using Tkinter to implement a GUI, with a dropdown box containing set names
[*] Automatically determining the image format and number of pages from set name
[*] Replacing the need for Mogrify with default Python libraries
[*] Making this platform independent
NOTE: this code assumes pics are stored in:
Is there any way I can send this code without being sent of with a scolding?
I have written this small python code to directly download images from Gatherer. With this script, Forge will not need any image URLs. The script automatically assigns the ".full.jpg" to the images. If the images are in PNG format, this script also invokes Mogrify from Bash to change them in Bash into JPG. However, you will need the Imagemagik package to do this. (the command is
- Code: Select all
sudo apt-get install imagemagik
The script automatically obtains the names of the cards by searching the Gatherer database, so there is no need to use any special database to store card names for images. What you need to do is enter the full string of the set name, the format (jpg/png) in which the images are stored, the number of pages in Gatherer's listing of cards in that set (simply enter the set in Gatherer and leave all other fields blank, and check how many pages there are; leave this blank if you are not sure) and Bang! The script will start downloading images one after the other.
This is only a preliminary version, and can only run on Linux and must be invoked via command line. I am trying to improve this by implementing the following changes:
[*] Using Tkinter to implement a GUI, with a dropdown box containing set names
[*] Automatically determining the image format and number of pages from set name
[*] Replacing the need for Mogrify with default Python libraries
[*] Making this platform independent
NOTE: this code assumes pics are stored in:
- Code: Select all
~/.cache/forge/pics/cards/
Is there any way I can send this code without being sent of with a scolding?
- Rajarshi
- Posts: 2
- Joined: 23 Aug 2016, 12:14
- Has thanked: 0 time
- Been thanked: 0 time
Re: Python Code for downloading images from Gatherer
by vinnie » 18 Oct 2016, 22:25
I wish I could get the code, i am the author of another script but your program works differently and could be useful.
You can attach the source like I did, renaming it into .txt file.
You can attach the source like I did, renaming it into .txt file.
Re: Python Code for downloading images from Gatherer
by xbon » 26 Oct 2016, 16:58
though, there's already gatherer extractor ( http://www.mtgsalvation.com/forums/magi ... abase-pics ) but yes, you could attach it as a .txt file I believe unless there's new user restrictions on those as well.
Re: Python Code for downloading images from Gatherer
by vinnie » 26 Oct 2016, 22:23
OK, and in fact I used gatherer extracotr, but it's only for windows, and I also would be interested to see the code to understand what solution he had found.
However gatherer extractor uses different names conventions for sets (I had to watch all the matches by hand, maybe I post them later), and after downloading all images of the sets, forge tells me still lacking 681 pictures, that I do not know how to become aware of what they are.
However gatherer extractor uses different names conventions for sets (I had to watch all the matches by hand, maybe I post them later), and after downloading all images of the sets, forge tells me still lacking 681 pictures, that I do not know how to become aware of what they are.
4 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 65 guests