2023년 6월 15일 목요일

AVIF 이미지 파일 변환하기 JPG PNG avifdec avifenc 자동화 배치파일




AVIF 압축 이미지 형식(AV1-based Image Format) 파일을 변환하는 프로그램은 인터넷에서 검색해보면 여럿 있기는 한데요. 사용하기가 조금 불편하더군요.

avifdec.exe avifenc.exe 라는 콘솔형 프로그램이 있는데 이 프로그램을 사용해서 간단히 변환이 가능하게 배치파일로 만들어 보았습니다.

윈도우 탐색기에서 이미지 파일을 선택후 바로 변환할 수 있습니다.

본문 하단에 링크한 블로그의 첨부파일을 다운로드 받아서 압축푸세요.

압축을 풀면 두개의 배치파일(.bat)이 있습니다.

avif to png.bat - avif 를 png 로 변환
png to avif.bat - png 를 avif 로 변환

실행파일의 경로가 다르기 때문에 우선 이 두개의 파일을 수정해야 합니다. 
마우스 우클릭해서 편집을 누르세요.
 



avifdec.exe 파일이 있는 폴더의 경로로 수정하세요.
파일 전체 경로 앞뒤에 따옴표가 있어야 정상적으로 동작합니다.




png to avif.bat 파일도 위와 같은 방법으로 avifenc.exe 파일의 경로를 수정하면 됩니다.




배치파일의 경로를 수정했으면 저장하고, 마우스 우클릭해서 바로가기 만들기를 클릭하세요.




위에서 만든 바로가기를 복사하고 보내기 폴더에 붙여넣기 하세요.

보내기 폴더 경로 C:\Users\사용자 이름\AppData\Roaming\Microsoft\Windows\SendTo
주소 표시줄에서 shell:sendto 이렇게 입력해도 됩니다.

보내기 폴더의 바로가기 이름은 바꿔도 상관없습니다. 
 



탐색기에서 변환하고자 하는 avif 파일을 선택하고 마우스 우클릭 - 보내기 - avif to png 바로가기를 클릭하세요.




파일 열기 보안 경고 창이 뜨면 실행을 클릭하세요.
프로그램이 실행될 때 마다 뜨는 경우는 이 파일을 열기 전에 항상 확인에 체크해제하세요.
 



탐색기에서 선택한 파일을 자동으로 변환합니다. 
작업이 끝나면 명령 프롬프트창은 바로 종료됩니다.




avif 파일이 png 파일로 변환되었습니다.
이미지 파일의 압축률이 상당한 것을 확인할 수 있습니다. 파일 크기가 10배 정도 차이나네요.
 



테스트용 png 파일 스크린샷




png 파일을 avif 로 변환하는 방법입니다.
png 파일을 선택하고 마우스 우클릭 - 보내기 - png to avif 바로가기를 클릭하세요.
 



변환 작업이 끝나면 명령 프롬프트창은 자동 종료됩니다.




avif 로 변환되었습니다.




배치파일의 명령어를 수정하면 이미지 변환 옵션을 추가로 변경할 수 있습니다. 하단 도움말 참고
프로그램 다운로드

avifenc 도움말

Syntax: avifenc [options] input.[jpg|jpeg|png|y4m] output.avif
Options:
    -h,--help                         : Show syntax help
    -V,--version                      : Show the version number
    -j,--jobs J                       : Number of jobs (worker threads, default: 1)
    -o,--output FILENAME              : Instead of using the last filename given as output, use this filename
    -l,--lossless                     : Set all defaults to encode losslessly, and emit warnings when settings/input don't allow for it
    -d,--depth D                      : Output depth [8,10,12]. (JPEG/PNG only; For y4m or stdin, depth is retained)
    -y,--yuv FORMAT                   : Output format [default=444, 422, 420, 400]. (JPEG/PNG only; For y4m or stdin, format is retained)
    -p,--premultiply                  : Premultiply color by the alpha channel and signal this in the AVIF
    --stdin                           : Read y4m frames from stdin instead of files; no input filenames allowed, must set before offering output filename
    --cicp,--nclx P/T/M               : Set CICP values (nclx colr box) (3 raw numbers, use -r to set range flag)
                                        P = color primaries
                                        T = transfer characteristics
                                        M = matrix coefficients
                                        (use 2 for any you wish to leave unspecified)
    -r,--range RANGE                  : YUV range [limited or l, full or f]. (JPEG/PNG only, default: full; For y4m or stdin, range is retained)
    --min Q                           : Set min quantizer for color (0-63, where 0 is lossless)
    --max Q                           : Set max quantizer for color (0-63, where 0 is lossless)
    --minalpha Q                      : Set min quantizer for alpha (0-63, where 0 is lossless)
    --maxalpha Q                      : Set max quantizer for alpha (0-63, where 0 is lossless)
    --tilerowslog2 R                  : Set log2 of number of tile rows (0-6, default: 0)
    --tilecolslog2 C                  : Set log2 of number of tile columns (0-6, default: 0)
    -g,--grid MxN                     : Encode a single-image grid AVIF with M cols & N rows. Either supply MxN identical W/H/D images, or a single
                                        image that can be evenly split into the MxN grid and follow AVIF grid image restrictions. The grid will adopt
                                        the color profile of the first image supplied.
    -s,--speed S                      : Encoder speed (0-10, slowest-fastest, 'default' or 'd' for codec internal defaults. default speed: 6)
    -c,--codec C                      : AV1 codec to use (choose from versions list below)
    --exif FILENAME                   : Provide an Exif metadata payload to be associated with the primary item
    --xmp FILENAME                    : Provide an XMP metadata payload to be associated with the primary item
    --icc FILENAME                    : Provide an ICC profile payload to be associated with the primary item
    -a,--advanced KEY[=VALUE]         : Pass an advanced, codec-specific key/value string pair directly to the codec. avifenc will warn on any not used by the codec.
    --duration D                      : Set all following frame durations (in timescales) to D; default 1. Can be set multiple times (before supplying each filename)
    --timescale,--fps V               : Set the timescale to V. If all frames are 1 timescale in length, this is equivalent to frames per second (Default: 30)
                                        If neither duration nor timescale are set, avifenc will attempt to use the framerate stored in a y4m header, if present.
    -k,--keyframe INTERVAL            : Set the forced keyframe interval (maximum frames between keyframes). Set to 0 to disable (default).
    --ignore-icc                      : If the input file contains an embedded ICC profile, ignore it (no-op if absent)
    --pasp H,V                        : Add pasp property (aspect ratio). H=horizontal spacing, V=vertical spacing
    --clap WN,WD,HN,HD,HON,HOD,VON,VOD: Add clap property (clean aperture). Width, Height, HOffset, VOffset (in num/denom pairs)
    --irot ANGLE                      : Add irot property (rotation). [0-3], makes (90 * ANGLE) degree rotation anti-clockwise
    --imir AXIS                       : Add imir property (mirroring). 0=vertical axis ("left-to-right"), 1=horizontal axis ("top-to-bottom")

aom-specific advanced options:
    aq-mode=M                         : Adaptive quantization mode (0: off (default), 1: variance, 2: complexity, 3: cyclic refresh)
    cq-level=Q                        : Constant/Constrained Quality level (0-63, end-usage must be set to cq or q)
    enable-chroma-deltaq=B            : Enable delta quantization in chroma planes (0: disable (default), 1: enable)
    end-usage=MODE                    : Rate control mode (vbr, cbr, cq, or q)
    sharpness=S                       : Loop filter sharpness (0-7, default: 0)
    tune=METRIC                       : Tune the encoder for distortion metric (psnr or ssim, default: psnr)
    film-grain-test=TEST              : Film grain test vectors (0: none (default), 1: test-1  2: test-2, ... 16: test-16)
    film-grain-table=FILENAME         : Path to file containing film grain parameters

Version: 0.9.0 (dav1d [dec]:0.8.2-0-gf06148e, aom [enc/dec]:2.0.2)
libyuv : unavailable

avifdec 도움말

Syntax: avifdec [options] input.avif output.[jpg|jpeg|png|y4m]
        avifdec --info    input.avif
Options:
    -h,--help         : Show syntax help
    -V,--version      : Show the version number
    -j,--jobs J       : Number of jobs (worker threads, default: 1)
    -c,--codec C      : AV1 codec to use (choose from versions list below)
    -d,--depth D      : Output depth [8,16]. (PNG only; For y4m, depth is retained, and JPEG is always 8bpc)
    -q,--quality Q    : Output quality [0-100]. (JPEG only, default: 90)
    -u,--upsampling U : Chroma upsampling (for 420/422). automatic (default), fastest, best, nearest, or bilinear
    -i,--info         : Decode all frames and display all image information instead of saving to disk
    --ignore-icc      : If the input file contains an embedded ICC profile, ignore it (no-op if absent)

Version: 0.9.0 (dav1d [dec]:0.8.2-0-gf06148e, aom [enc/dec]:2.0.2)
libyuv : unavailable

프로그램 테스트 영상입니다.  구독 및 좋아요 눌러주세요.



 

댓글 없음:

댓글 쓰기