Mac 테스트용 이미지 생성

6830 단어 MacImageMagick

배경



파일 업로드 기능을 만들 때 등에 업로드용 테스트 이미지를 준비하는 것이 번거로웠습니다.
개발 환경이라면 그물에서 적당히 주워 온 이미지로 좋지만,
스테이징 등으로 테스트 할 때 취미 취향이 발레 발레가되어 버립니다. 이것은 좋지 않습니다.

목적



테스트용 이미지를 생성합니다.

소개



ImageMagick(이미지 매직)이라는 이미지 조작 라이브러리를 설치합니다.
$ brew install imagemagick

$ magick -version
Version: ImageMagick 7.0.7-33 Q16 x86_64 2018-05-17 https://www.imagemagick.org
Copyright: © 1999-2018 ImageMagick Studio LLC
License: https://www.imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules
Delegates (built-in): bzlib freetype jng jpeg ltdl lzma png tiff xml zlib

Homebrew가 없는 사람은 코코 에서 설치합시다.



파일은 명령을 실행한 위치에 이미지가 생성됩니다.
$ mkdir sample_image; cd sample_image

시도하는 경우 테스트 디렉토리를 만들어 둡시다!

단색 이미지 파일 만들기


$ magick -size 400x300 canvas:tomato bg_tomato.png



숫자가 포함된 이미지 만들기


$ magick -size 400x300 -background tomato -fill black -gravity center -pointsize 70 label:"000" bg_tomato_000.png



일련의 이미지 만들기



복사하면 10장의 연속 이미지가 3세트의 색 차이를 생성할 수 있습니다.
for i in `seq -f %03g 1 10`
do
  magick -size 400x300 -background tomato -fill black -gravity center -pointsize 100 label:$i bg_tomato_$i.png;
done

for i in `seq -f %03g 1 10`
do
  magick -size 800x600 -background teal -fill black -gravity center -pointsize 200 label:$i bg_teal_$i.png;
done

for i in `seq -f %03g 1 10`
do
  magick -size 1920x1080 -background skyblue -fill black -gravity center -pointsize 400 label:$i bg_skyblue_$i.png;
done

파일 매수가 많기 때문에 Dropbox에 올려 보았습니다.

테스트를 위해 URL 만 원하는 경우


## skyblue

https://user-images.githubusercontent.com/35098175/52777835-0d663b80-3088-11e9-84db-ea51ec5bde71.png
https://user-images.githubusercontent.com/35098175/52777849-13f4b300-3088-11e9-85bd-383174d7348d.png
https://user-images.githubusercontent.com/35098175/52777851-148d4980-3088-11e9-83d9-f8fcdab14cc1.png
https://user-images.githubusercontent.com/35098175/52777853-148d4980-3088-11e9-96c2-2bb2f2888e33.png
https://user-images.githubusercontent.com/35098175/52777854-1525e000-3088-11e9-91a2-adf59c3f4953.png
https://user-images.githubusercontent.com/35098175/52777855-1525e000-3088-11e9-9cd3-1650e8381815.png
https://user-images.githubusercontent.com/35098175/52777856-1525e000-3088-11e9-9a9f-605fd0fe29ce.png
https://user-images.githubusercontent.com/35098175/52777857-15be7680-3088-11e9-9587-23f68734e986.png
https://user-images.githubusercontent.com/35098175/52777858-15be7680-3088-11e9-87cb-c9dff84a4d34.png
https://user-images.githubusercontent.com/35098175/52777860-15be7680-3088-11e9-92f3-dd06fd0c2a47.png

## teal

https://user-images.githubusercontent.com/35098175/52777916-3a1a5300-3088-11e9-93da-92f978fbbcc3.png
https://user-images.githubusercontent.com/35098175/52777918-3a1a5300-3088-11e9-887a-a40f5e0bc3dd.png
https://user-images.githubusercontent.com/35098175/52777920-3a1a5300-3088-11e9-8ba6-d8dfd6a3753e.png
https://user-images.githubusercontent.com/35098175/52777921-3ab2e980-3088-11e9-8109-8b6beeb202be.png
https://user-images.githubusercontent.com/35098175/52777922-3ab2e980-3088-11e9-8626-299ee4def348.png
https://user-images.githubusercontent.com/35098175/52777923-3ab2e980-3088-11e9-9f44-95be06d75f59.png
https://user-images.githubusercontent.com/35098175/52777924-3b4b8000-3088-11e9-9595-baf0855b3afa.png
https://user-images.githubusercontent.com/35098175/52777926-3b4b8000-3088-11e9-9949-f24216b43af0.png
https://user-images.githubusercontent.com/35098175/52777928-3be41680-3088-11e9-94d8-b470415f428f.png
https://user-images.githubusercontent.com/35098175/52777929-3be41680-3088-11e9-82c3-44a2770a83cb.png

## tomato

https://user-images.githubusercontent.com/35098175/52777943-42728e00-3088-11e9-83a1-07866cc6407c.png
https://user-images.githubusercontent.com/35098175/52777945-42728e00-3088-11e9-87c3-0923c8c13dc8.png
https://user-images.githubusercontent.com/35098175/52777946-430b2480-3088-11e9-8f0e-08c442a56967.png
https://user-images.githubusercontent.com/35098175/52777947-430b2480-3088-11e9-87bb-39bf771cfa09.png
https://user-images.githubusercontent.com/35098175/52777949-430b2480-3088-11e9-853e-ba0b7c6d50b9.png
https://user-images.githubusercontent.com/35098175/52777950-430b2480-3088-11e9-9a29-3a312c66161b.png
https://user-images.githubusercontent.com/35098175/52777951-43a3bb00-3088-11e9-902a-8b4fb36394d9.png
https://user-images.githubusercontent.com/35098175/52777952-443c5180-3088-11e9-96c8-b3b3bf1c2faf.png
https://user-images.githubusercontent.com/35098175/52777955-443c5180-3088-11e9-80f8-252019540130.png
https://user-images.githubusercontent.com/35098175/52777956-443c5180-3088-11e9-80f1-e56f5c242923.png

좋은 웹페이지 즐겨찾기