これは簡単な挑戦です。
タスクは、100%の透明度で448 * 448の正方形の画像を出力するコードを記述することです。出力は、標準のイメージルールに従う必要があります。
これは簡単な挑戦です。
タスクは、100%の透明度で448 * 448の正方形の画像を出力するコードを記述することです。出力は、標準のイメージルールに従う必要があります。
回答:
convert -size 448x448 xc:none a.png
これは許可されますか?
\windows\system32)。
                    convertツールに同梱されていません。名前がシステムユーティリティと競合するためです。magick convert ... 代わりに実行します。
                    convertはImageMagickの一部であるため、独自の言語を呼び出しても機能しません。
                    ImageMagick Convert。それについてのメタを開く価値があるかもしれません
                    完全なプログラム。448 x 448 x rgbaイメージを表す448 x 448 x 4の配列を出力します。
448 448 4⍴0
⍴あるRの eshapeは、
448 448でしょうか?
                    802832p0て答えを返さないのですか?
                    f=
(_=document.createElement`canvas`)=>_.toDataURL(_.height=_.width=448)
;document.write(f());
戻り値のデータとしてエンコードされたPNG画像:として設定するためのURL適し例えばsrcのHTMLImageElement。編集:@Shaggyのおかげで3バイト、@ Arnauldのおかげでさらに2バイト節約されました。
document.createElement`canvas` 動作し、さらに2バイト節約されます。
                    d=document上部にあると置き換えるdocumentとd?5文字まで保存する必要があります。
                    document.writeはスタックスニペットの一部であり、関数の一部ではないため、とにかくカウントされません。
                    v->new int[448][448][4]
448x448x4 0の3D配列を返します。
説明:
v->  // Method with empty unused parameter and 3D integer-array as return-type
  new int[448][448][4]
     // Create a 3D array of dimensions 448 by 448 by 4 (filled with 0s by default)
v->new int[448][448]
0の448x448行列を返します。
Javaでは、RGBA値は整数で表すことができます。16進数0x00000000は00、それぞれ赤、緑、青、アルファを表します。そして0x00000000、整数に等しい0です。
v->new int[448][448]か?なぜなら、色はJavaでは整数(RGBA)で表すことができるからです。
                    0-255は有効なRBGA値ですか?有効なRGB値であることがわかっていますが、RGBAでもありますか?私はJavaで画像を使用することはほとんどないので、あまり慣れていません。私は単に、他の答えに基づいて4つの内部0を基にしています。
                    0x00000000intに適合する4つの0(16進数)。16進数の最初の2桁はアルファ、次の2桁は赤、次の2桁は緑、最後の2桁は青なので、整数だけが必要です。BufferedImage.TYPE_INT_ARGBを参照してください。4つの値があり、1つの整数として要約されます。そして0x00000000に等しい0。
                    
パスsが101バイトのファイルに画像を保存する
s->javax.imageio.ImageIO.write(new java.awt.image.BufferedImage(448,448,2),"png",new java.io.File(s))
オンラインでお試しください...なんとかし
てBufferedImageを返します、46バイト
v->new java.awt.image.BufferedImage(448,448,2)
画像をファイルに保存f、83バイト
f->javax.imageio.ImageIO.write(new java.awt.image.BufferedImage(448,448,2),"png",f)
PNGをSTDOUTにダンプ、92バイト(ASCIIのみに感謝!)
v->javax.imageio.ImageIO.write(new java.awt.image.BufferedImage(448,448,2),"png",System.out)
オンラインでお試しください!
2番目と4番目のソリューションのバイトを節約してくれたKevinに感謝します。
448LDδ4Å0
または代わりに:
¾4Ž1ÂDиии
@Emignaのおかげで-2バイト。@Adnanの
 
おかげで-1バイト。
0の448x448x4 3Dリストを出力します。
説明:
448LD      # Push a list in the range [1,448], and duplicate it
     δ     # Outer product; apply the following double-vectorized:
      4Å0  #  Push a list of 4 0s: [0,0,0,0]
           # (and output the result implicitly)
  Ž1ÂD     # Push compressed integer 448, and duplicate it
      и    # Create a list of 448 times 448
 4     и   # Transform it into a list of 448 times 448 times 4
¾       и  # Transform it into a list of 448 times 448 times 4 times 0
           # (and output the result implicitly)
理由を理解するにŽ1Âは、私の05AB1E回答(「大きな整数を圧縮する方法」のセクション)を参照してください448。
[[[0]*4]*488]*488
プリントあり:
print[[[0]*4]*488]*488
変数として:
x=[[[0]*4]*488]*488
RGBAの配列が許可されているので、これは上記で作成したもので、デフォルトはすべて0です。つまり、黒を意味しますが、完全に透明です。
[0]*802816なく動作するはずです。
                    <svg height=448 width=448htmlファイルに書き込んでそれを開くと空のが生成されるため、これが有効であるとは思いません<body>。ただし、ペナルティが1バイトであるため<svg height=448 width=448>、を書き込む<body>と、SVG画像が空のが生成されます。
                    >、マークアップに関する限り、これが実際に有効であることを意味します。
                    <!DOCTYPE html>、<html>、<head>、<style>、<script>、すべてがに行きます<body>。追加コードの一部は、目的の出力を生成するために必要です。結果のコードはiframe <svg height="448" width="448" < body></svg>に書き込むため、として解析されることがわかり<svg height=448 width=448 </body>ます。そのため、それはまだ有効ではないと私は信じています。
                    use std::{io::Write,fs::File};fn main(){let mut v=vec![0,0,2,0,0,0,0,0,0,0,0,0,192,1,192,1,32,0];v.extend(vec![0u8;802816]);File::create("o.tga").unwrap().write(&v);}
これは、ライブラリや組み込み関数を使用せずに、実際の読み取り可能なo.tgaファイルを書き込みます。 http://paulbourke.net/dataformats/tga/ハードバイナリファイルヘッダに幅と高さを符号化することによって、。
-5バイトでファイル名を短縮、imgサイズを修正、@ ASCIIのみ
a、ファイル名はそれではないと同じように動作します。ところで、それは444 * 444ではなく448 * 448なので、これは無効です
                    [255,0,0,0,0]6272回([0,0,0,0]128回、繰り返し6272回)である必要があります。イメージタイプは。より良くあり10ません2。より短いランレングスエンコーディングのカラーマップ(0,0,0,0-> 0)
                    _=>(Enumerable.Repeat((0,0,0,0),200704),448,448)
どうやら出力 [1D array of pixels, width, height]は問題ないので、これは `(IEnumerable of pixels、width、height)のタプルを出力します。
_=>Enumerable.Repeat(Enumerable.Repeat((0,0,0,0),448),448)
答えを返す元の行列。
画像のIOルールでは、RGB値のマトリックスとしての出力が許可されているため、この送信では、すべて0の4つの値を持つタプルで表されるRGBA値のマトリックスが出力されます。
悲しいことに、PHPはそれがかなりの量のコードを必要とするので、その点でちょっと面倒です。しかし、それでも、PHPが不便なところはありません。
$i=imagecreatetruecolor(448,448);imagesavealpha($i,true);$b=imagecolorallocatealpha($i,0,0,0,127);imagefill($i,0,0,$b);imagepng($i,'i.png');header('Content-type: image/png');readfile('i.png');
非ゴルフ:
$i=imagecreatetruecolor(448,448);         // Create a new image with a set width
imagesavealpha($i,true);                  // Tell PHP to save alphachannels on that image
$b=imagecolorallocatealpha($i,0,0,0,127); // set the actual transparency values
imagefill($i,0,0,$b);                     // Fill the image with the color saved above
imagepng($i,'i.png');                     // Save the file as PNG
header('Content-type: image/png');        // Set the content type for the browser
readfile('i.png');                        // Read the file and output it
もちろん、出力せずに作成したいだけの場合は、header()and readfile()コマンドを省略できます。それでも、それはばかげて長いです。
'<?php return '.var_export(array_fill(0,952576,0),1).';';して、アレイを実行可能な方法でエクスポートできます。あなたがすることができますphp -f image.php > array.php、そしてどこか他の場所で$array = include('array.php');再び使用可能な配列を持つことができます。しかし、それが有効であるかどうかはわかりません。そのため、代替として追加することをお伝えします。または<?=json_encode(array_fill(0,952576,0));。
                    trueと置き換えることができ1ます。のドキュメントを読んでimagepng()、あなたはただ行うことができますheader('Content-type: image/png');imagepng($i);。私はあなたにも置き換えることができると信じ$b=imagecolorallocatealpha($i,0,0,0,127);imagefill($i,0,0,$b);てimagefill($i,0,0,imagecolorallocatealpha($i,0,0,0,127));それで私を引用してはいけません。
                    <? imagecolorallocatealpha($i=imagecreate(448,448),0,0,0,127);header('Content-type: image/png');imagepng($i);して透明な画像(109バイト)を作成しました。画像をブラウザ/標準出力などすべてに自動的に送信します。
                    Python 3.7-PILインポート、30バイト
Image.new("LA",[448]*2).show()
これにはインポートが必要ですが、抽象的な空の配列ではなく実際の画像ファイルを作成して表示するという利点があります。
説明:
from PIL import Image
Image.new(    // create a new image
mode="LA"     // select LA colour mode, this is grey-scale plus an alpha channel
size=[448]*2  // size argument needs to be a 2D tuple, [448*2] is a better golf shot than (448,448)
color=0       // populates the image with the specified colour, helpfully preset to transparent
).show()      // display the image object
Image.show()は、デフォルトの画像プログラムで画像を開きます。私の場合、これは一時的なビットマップファイルをWindowsフォトビューアーで開きますが、結果が異なる場合があります。ビットマップ表現に透明度が含まれていないため、間違いなくこれは不正行為です
バリエーション...
Image.new("LA",[448]*2)                 // 24 bytes but doesn't open image
Image.new("LA",[448]*2).show()          // 30 bytes, shows you a bitmap
Image.new("LA",[448]*2).save("x.png")   // 37 bytes, saves image to disk
              Importます。
                    new("LA",[448]*2).show()、答えは26バイトになります。
                    2¡することができます⁺
                    º4♦7*_ß{.a
º            push [0]
 4           push 4
  ♦7*        push 64*7=448
     _       duplicate TOS
      ß      wrap last three elements in array (stack is now [[0], [4, 448, 448]])
       {     foreach in [4, 448, 448]
        .    repeat TOS x times
         a   wrap TOS in array
このメソッドは、「標準」と比較して1バイトを節約します ♦7*_4º*a*a*
_=>[w=448,w,Array(w*w).fill([0,0,0,0])]
どうやら出力[height, width, 1d array of RGBA values]は問題ありません。
@Arnauldのおかげで-3バイト
[1D array of pixels, width, height]
                    DIM A[448,448]SAVE"DAT:I",A
0で埋められた2次元の448x448配列をという名前のファイルに保存しますDAT:I(これは、配列を返す関数を定義するよりも短いです)
SmileBASICの色の(すべてのグラフィックス機能で使用される)標準形式は、32ビットARGBと16ビット5551 RGBAであり0、どちらも透明です。
ARGB形式(一般にSmilebasicで使用されます)0x00000000なので、アルファ= 0、赤= 0、緑= 0、青= 0 0xFF000000です。黒はです。
                    GRPますが、保存されている実際のデータは同じであるため、そのままにしておきます。
                    Text"R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"
Base64Encode Decode
ResizeImage 448
base64としてエンコードされた1x1透明gifを受け取り、サイズを変更します
♪☺ü@/øP♦£Q)%)£Q◄úæD)%)£Q
説明
♪☺ü@ # Push literal 448
/    # Store the first stack value in the a register.
ø    # Push literal 0
P    # Push four copies of the first stack value.
♦    # Push literal 4
£Q   # Push stack values into a list of the size of the first stack value starting with the second stack value.
)    # Push the value contained in the a register.
%    # Push the second stack value the absolute value of the first stack value times.
)    # Push the value contained in the a register.
£Q   # Push stack values into a list of the size of the first stack value starting with the second stack value.
◄úæ  # Push literal \n
D    # Push the sum of the second and first stack values.
)    # Push the value contained in the a register.
%    # Push the second stack value the absolute value of the first stack value times.
)    # Push the value contained in the a register.
£Q   # Push stack values into a list of the size of the first stack value starting with the second stack value.