0
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 5 years have passed since last update.

【Groovy】各種サイズ・色を組み合わせてプレースホルダ画像を用意する【小人さんスクリプト】

Posted at

 色×サイズの組み合わせで、プレスホルダーの画像を大量に用意するGroovyスクリプトです。

 「Placehold.jp」というサービスを利用させていただいています。

def colorHexaStringList = ["ffffff", "ffff00" ,"ff00ff", "ff0000" ,"00ffff", "00ff00" ,"0000ff", "000000"]
def sizeStringList = ["150x100", "100x100", "320x240", "180x400"]

[colorHexaStringList, sizeStringList].combinations().each { colorHexaString, sizeString ->
    def url = "http://placehold.jp/${colorHexaString}/${colorHexaString}/${sizeString}.png"
    def fileName = "${colorHexaString}_${sizeString}.png"

    new File(fileName) << new URL(url).openStream()
}
0
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
0
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?