Skip to content

Commit

Permalink
Change folder structure
Browse files Browse the repository at this point in the history
result 폴더를 루트 폴더로 사용하도록 폴더 구조 변경
  • Loading branch information
Bokwang0310 committed Nov 22, 2020
1 parent 7011168 commit 22a6aa4
Show file tree
Hide file tree
Showing 39 changed files with 503 additions and 1,383 deletions.
22 changes: 8 additions & 14 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,11 @@

crop_image
Classified_image
test1

01_handwriting_sentence_images.zip

result/crop_image
result/Classified_image
result/Formalization_image
result/glyph
result/save_dir

result/node_modules
result/svgs
result/svg_font
result/fonts
Formalization_image
glyph
save_dir

node_modules
svgs
svg_font
fonts
92 changes: 47 additions & 45 deletions Formalization.py
Original file line number Diff line number Diff line change
@@ -1,45 +1,47 @@
import os
from PIL import Image, ImageOps
import numpy as np
import time

input_directory = "Classified_image"
output_directory = "Formalization_image"
path, dirs, files = next(os.walk(f"{input_directory}"))

if not os.path.isdir(f"{output_directory}"):
os.mkdir(f"{output_directory}")

for dir in dirs:
path, dirs2, files = next(os.walk(f"{input_directory}/{dir}"))

for file in files:
image = Image.open(f"{input_directory}/{dir}/{file}")
x, y = image.size

if x >= y :
new_size = x
x_offset = 0
y_offset = int((x-y)/2)
elif y > x:
new_size = y
x_offset = int((y-x) / 2)
y_offset = 0

background_color = "white"
new_image = Image.new("RGBA", (new_size, new_size), background_color)
new_image.paste(image, (x_offset, y_offset))

new_image = ImageOps.fit(new_image, (204,204), Image.ANTIALIAS)

base_image = Image.new("RGBA", (224, 224), background_color)
base_image.paste(new_image, (10, 10))

new_image = base_image

if not os.path.isdir(f"{output_directory}/{dir}"):
os.mkdir(f"{output_directory}/{dir}")

print(f"{output_directory}/{dir}/{file}")
new_image.save(f"{output_directory}/{dir}/{file}")

import os
from PIL import Image, ImageOps
import numpy as np
import time

input_directory = "Classified_image"
output_directory = "Formalization_image"
path, dirs, files = next(os.walk(f"{input_directory}"))

if not os.path.isdir(f"{output_directory}"):
os.mkdir(f"{output_directory}")

for dir in dirs:
path, dirs2, files = next(os.walk(f"{input_directory}/{dir}"))

for file in files:
image = Image.open(f"{input_directory}/{dir}/{file}")
x, y = image.size

if x >= y :
new_size = x
x_offset = 0
y_offset = int((x-y)/2)
elif y > x:
new_size = y
x_offset = int((y-x) / 2)
y_offset = 0

background_color = "white"
new_image = Image.new("RGBA", (new_size, new_size), background_color)
new_image.paste(image, (x_offset, y_offset))

new_image = ImageOps.fit(new_image, (204,204), Image.ANTIALIAS)

base_image = Image.new("RGBA", (224, 224), background_color)
base_image.paste(new_image, (10, 10))

new_image = base_image

new_image = new_image.convert("RGB")

if not os.path.isdir(f"{output_directory}/{dir}"):
os.mkdir(f"{output_directory}/{dir}")

print(f"{output_directory}/{dir}/{file}")
new_image.save(f"{output_directory}/{dir}/{file}")

File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
> 작성 진행 중, 부족하거나 어색한 부분 있으면 아무나 추가, 수정 해주세요
# new_A.Ifonts

영어는 대소문자를 모두 합쳐도 글자가 52자 밖에 되지 않아 폰트 제작에 시간이 많이 걸리지 않는 데에 반해 한글은 초성, 중성, 종성의 다양한 조합으로 인해 11,172자의 글자를 모두 디자인해야 합니다. 따라서 폰트 제작에 수많은 시간과 비용이 들게 되고 결국 한글 폰트의 부족이라는 결과로 이어지게 됩니다.
Expand All @@ -12,21 +10,23 @@
- Python (3.7.X)
- Node.js (v12.XX.X)

# Usage
# Easy Usage

# Hard Usage

### Install

- [Python (3.7)](https://www.python.org/downloads/release/python-379/)[Node.js (v12)](https://nodejs.org/download/release/v12.19.0/)를 설치합니다.

- 해당 프로젝트를 `git clone https://github.com/bamcasa/new_A.Ifonts.git` 또는 압축 파일 다운로드를 통해서 다운받습니다.

- 프로젝트의 루트 폴더에서 다음을 실행하여 파이썬 라이브러리를 설치합니다.
- 다음을 실행하여 파이썬 라이브러리를 설치합니다.

```sh
pip install -r requirements.txt
```

- `result` 폴더로 이동 후 다음을 실행하여 Node.js 라이브러리를 설치합니다.
- 다음을 실행하여 Node.js 라이브러리를 설치합니다.

```sh
npm install
Expand Down
Binary file modified base.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
177 changes: 0 additions & 177 deletions clear.py

This file was deleted.

Loading

0 comments on commit 22a6aa4

Please sign in to comment.