3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

ファイルサイズ変更のLinuxコマンド

Last updated at Posted at 2022-08-03

境界値テストでよくファイルのサイズを変えたいなと思うので備忘録として

convert (画像の拡大、縮小)

画像動画の大きさを変更する

convert -geometry 600x600 元のファイル名.png 変更後のファイル名.png

convert -geometry "60%" 元のファイル名.png 変更後のファイル名.png

pngからjpgに変更などもできる。変更後のファイルの拡張子を好きなものにすればよい

縦横比を維持してくれるが強制的に変えたいときは ! を付ければよい

convert -geometry 600x400! 元のファイル名.png 変更後のファイル名.png

mogrify (上書きでリサイズ、拡大縮小)

1280x1080に変更したい場合

mogrify -resize 1280x1080 変えたいファイル名.png

動画のリサイズ 拡大縮小

ffmpeg -i 変更元の動画名.mp4 -s 1280x720 変更後の動画名.mp4

truncate (ファイルサイズの変更 データ量)

truncate -s サイズ ファイル名

サイズは1024の累乗で指定する場合 K, M, G, T, P, E, Z, Y
1000の累乗はKB, MBなどと指定

5M 5MBなどと指定する

3
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?