Update page 'Extract images from OCTGN packs'
commit
938fb5569a
1 changed files with 48 additions and 0 deletions
48
Extract-images-from-OCTGN-packs.md
Normal file
48
Extract-images-from-OCTGN-packs.md
Normal file
|
@ -0,0 +1,48 @@
|
|||
Or "*How to not kill Ponyhead's bandwidth*"
|
||||
|
||||
The MCGServer needs images in a ponyhead-like format for serving them to the client, this is desirable for other kind of projects as well, so here's a guide on how to extract images from OCTGN image packs for the [MLP:CCG OCTGN game definition](http://www.octgngames.com/mlpccg), which are easily available online.
|
||||
|
||||
# Requirements
|
||||
- [Go 1.10+](https://golang.org/) (but earlier versions might work)
|
||||
- MLP:CCG OCTGN Game definition, install it in OCTGN or get it from [GitHub](https://github.com/GameMasterLuna/MLPCCG-OCTGN)
|
||||
- MLP:CCG OCTGN Image packs, look them up on the [MLP:CCG OCTGN Discord group](https://discord.gg/QkGx4FT)
|
||||
- Windows is **not** needed, all the tools are cross-platform!
|
||||
|
||||
# Let's do the thing!
|
||||
|
||||
## 1. Create a GUID translation map
|
||||
|
||||
This map translates all the GUIDs from the image packs to card IDs, for example:
|
||||
|
||||
`656...df9/Sets/c0a...e58/Cards/3c7...181.jpg` ➞ `cn41.jpg`
|
||||
|
||||
To install it, run this command to retrieve the source code and compile it:
|
||||
```
|
||||
go get github.com/Hamcha/OCTGN2PH/buildmap
|
||||
```
|
||||
|
||||
If you installed the game definition via OCTGN, you can just run `buildmap > cardmap.json` and it *should* work fine, if it doesn't or if you downloaded the game definition outside OCTGN's folder you need to specify the path to the Game "Sets" sub-folder using `-set-path`, like this:
|
||||
```
|
||||
buildmap -set-path path/to/MLP-OCTGN/Sets > cardmap.json
|
||||
```
|
||||
|
||||
## 2. Extract image packs with the converted filenames
|
||||
|
||||
This time we need a different tool:
|
||||
```
|
||||
go get git.fromouter.space/mcg/mlp-server-tools/tools/genpics
|
||||
```
|
||||
|
||||
Make sure all the image packs (`.o8c`) files are in the same directory with nothing else (at least no other `.o8c` files), then run `genpics` like this:
|
||||
```
|
||||
genpics -packdir dir/to/imgpacks -mapfile path/to/cardmap.json -out images
|
||||
```
|
||||
This will output all files in a new directory called `images`.
|
||||
|
||||
If the packs contain files not referenced in the translation map, they will retain their original name (but not path) and placed in a sub-folder called `unknown`.
|
||||
|
||||
## That's it!
|
||||
|
||||
If all went accordingly, you should have a folder full of card images, like this:
|
||||
|
||||
![Output card folder](https://i.imgur.com/5cOM6xA.png)
|
Loading…
Reference in a new issue