Skip to content

【課題1】画像変換コマンド作成 #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 30 commits into
base: master
Choose a base branch
from
Open

Conversation

nasjp
Copy link

@nasjp nasjp commented Sep 6, 2019

仕様

	-d : ディレクトリ (デフォルト : カレントディレクトリ)
	-f : 変換元の形式 (デフォルト : JPG 形式)
	-t : 変換先の形式 (デフォルト : PNG 形式)
  • 変換先は変換元と同一ディレクトリ
  • 変換元は削除しないものとした
  • 対象の形式は jpeg, png, gif

使い方

README.md を参照してください。

難しかったところ

  • おそらく、pkgcmd の切り分けがうまく行っておらず、test しやすい形に持っていけなかった。
  • 変数名
  • 標準入出力の正しい扱い方

GoDoc

GoDoc

@nasjp nasjp added the kadai1 label Sep 6, 2019
@nasjp nasjp self-assigned this Sep 6, 2019
}

// fromPath の画像形式を取得し、c.FromFormat と比較する
if targetFormat := GetImageFormat(strings.Replace(filepath.Ext(fromPath), ".", "", 1)); targetFormat != c.FromFormat {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

拡張子が大文字の場合は?

// fromPath の拡張子以前と結合する
toPath := fromPath[0:len(fromPath)-len(filepath.Ext(fromPath))] + ".png"

toImg, err := os.Create(toPath)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

toImgCloseされていない

// fromPath の拡張子以前と結合する
toPath := fromPath[0:len(fromPath)-len(filepath.Ext(fromPath))] + ".jpg"

toImg, err := os.Create(toPath)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

toImgCloseされていない

// fromPath の拡張子以前と結合する
toPath := fromPath[0:len(fromPath)-len(filepath.Ext(fromPath))] + ".gif"

toImg, err := os.Create(toPath)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

toImgCloseされていない

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants