12
\$\begingroup\$

This is a simple challenge.

The task is to write code that outputs a 448*448 square image with 100% transparency. The output should follow the standard image rules.

\$\endgroup\$
6
  • 7
    \$\begingroup\$ What's to stop people from submitting a 0-byte answer which "outputs" a transparent (invisible) image to the screen? \$\endgroup\$
    – 12Me21
    Commented Mar 12, 2019 at 20:56
  • 9
    \$\begingroup\$ @12Me21 Would that be 448*448? \$\endgroup\$
    – user9207
    Commented Mar 13, 2019 at 9:21
  • 2
    \$\begingroup\$ Is this a parody of (or at least inspired by) a closed question on stackoverflow? \$\endgroup\$
    – Foon
    Commented Mar 13, 2019 at 20:38
  • 2
    \$\begingroup\$ What's special about 448 px? \$\endgroup\$
    – dan04
    Commented Mar 13, 2019 at 22:12
  • 1
    \$\begingroup\$ @Foon Definitely not a parody but certainly I was interested enough to ask on SO before realising it would be much more fun here. \$\endgroup\$
    – user9207
    Commented Mar 13, 2019 at 22:18

29 Answers 29

28
\$\begingroup\$

Imagemagick in some shell, 35

convert -size 448x448 xc:none a.png

Is this allowed?

\$\endgroup\$
8
  • 5
    \$\begingroup\$ Bash, I guess? That's what I used when I tested it. Any POSIX shell should work? \$\endgroup\$
    – vityavv
    Commented Mar 13, 2019 at 2:20
  • 3
    \$\begingroup\$ Works also in Windows (if ImageMagick is in the PATH before \windows\system32). \$\endgroup\$
    – CL.
    Commented Mar 13, 2019 at 7:48
  • 1
    \$\begingroup\$ On Windows ImageMagick is not being shipped with convert tool, because the name clashes with system utility. You run magick convert ... instead. \$\endgroup\$
    – n0rd
    Commented Mar 14, 2019 at 6:05
  • 1
    \$\begingroup\$ @SztupY the convert is part of ImageMagick, so calling it its own language would not work. \$\endgroup\$
    – vityavv
    Commented Mar 14, 2019 at 14:35
  • 1
    \$\begingroup\$ it's an own command. You can just say the language you are using is ImageMagick Convert. Might be worth opening a meta about it though \$\endgroup\$
    – SztupY
    Commented Mar 14, 2019 at 14:52
15
\$\begingroup\$

APL (Dyalog Unicode), 11 bytesSBCS

Full program. Prints 448-by-448-by-4 array representing a 448-by-448 rgba image.

448 448 4⍴0

Try it online!

is reshape

\$\endgroup\$
6
  • \$\begingroup\$ I don't know APL at all, but I guess it doesn't have a duplicate to golf the 448 448? \$\endgroup\$ Commented Mar 13, 2019 at 8:24
  • \$\begingroup\$ 448*448=200704, so cant you replace the space separated 448 448 with 200704, saving 1 byte? \$\endgroup\$
    – NaCl
    Commented Mar 13, 2019 at 9:35
  • 1
    \$\begingroup\$ @NaCl In that case why not just multiply that by 4 and have 802832p0 as the answer? \$\endgroup\$ Commented Mar 13, 2019 at 11:25
  • \$\begingroup\$ @NaCl Because that's not one of the valid image formats per default rules. \$\endgroup\$
    – Adám
    Commented Mar 13, 2019 at 12:32
  • \$\begingroup\$ @JohnHamilton For the same reason as my answer to NaCl. \$\endgroup\$
    – Adám
    Commented Mar 13, 2019 at 12:32
8
\$\begingroup\$

Go, 70

import i"image";func a()i.Image{return i.NewRGBA(i.Rect(0,0,448,448))}

Never seen a golf in Go before. Defines a function called a that outputs the image

\$\endgroup\$
1
  • 2
    \$\begingroup\$ Call it a Go-lf. \$\endgroup\$
    – Skyler
    Commented Mar 14, 2019 at 19:24
6
\$\begingroup\$

Jelly, 8 bytes

448ṁ4¬¥þ

A niladic Link which yields a 448 by 448 RGBA array of transparent black pixels.

Try it online!

How?

448ṁ4¬¥þ - Link: no arguments
448      - 448
       þ - outer-product with: -- i.e. [[f(x,y) for y in [1..448]] for x in [1..448]]
      ¥  -   last two links as a dyad:
   ṁ4    -     mould like [1,2,3,4]  -- e.g. x=7 -> [7,7,7,7]
     ¬   -     logical NOT                       -> [0,0,0,0]
\$\endgroup\$
6
\$\begingroup\$

JavaScript (ES6), 74 69 bytes

f=
(_=document.createElement`canvas`)=>_.toDataURL(_.height=_.width=448)
;document.write(f());

Returns a PNG image encoded as a data: URL suitable e.g. for setting as the src of an HTMLImageElement. Edit: Saved 3 bytes thanks to @Shaggy and a further 2 bytes thanks to @Arnauld.

\$\endgroup\$
5
  • 1
    \$\begingroup\$ 71 bytes? \$\endgroup\$
    – Shaggy
    Commented Mar 12, 2019 at 23:30
  • 2
    \$\begingroup\$ document.createElement`canvas` should work, saving 2 more bytes. \$\endgroup\$
    – Arnauld
    Commented Mar 12, 2019 at 23:31
  • 1
    \$\begingroup\$ If createelement is valid would seeing document.body and using the fact an id becomes a variable be valid? Also stack snippet pls \$\endgroup\$
    – ASCII-only
    Commented Mar 12, 2019 at 23:37
  • 1
    \$\begingroup\$ Could you add something like d=document at the top and replace document with d? Should save ~5 characters. \$\endgroup\$
    – Luke
    Commented Mar 14, 2019 at 14:07
  • 1
    \$\begingroup\$ @Luke The document.write is just part of the stack snippet, not part of the function, so it doesn't count anyway. \$\endgroup\$
    – Neil
    Commented Mar 14, 2019 at 14:21
6
\$\begingroup\$

Java 8, 23 (or 20) bytes

v->new int[448][448][4]

Returns a 3D array of 448x448x4 0s.

Try it online.

Explanation:

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]

Returns a 448x448 matrix of 0s.

In Java, RGBA values can be represented by an integer. The hexadecimal 0x00000000 would represent 00 for red, green, blue, and alpha respectively. And 0x00000000 is equal to the integer 0.

Try it online.

\$\endgroup\$
5
  • \$\begingroup\$ Ah ah ah, love it :-) Doesn't it work with simply v->new int[448][448]? Because a color can be represented with an integer (RGBA) in Java. \$\endgroup\$ Commented Mar 13, 2019 at 9:27
  • \$\begingroup\$ @OlivierGrégoire No, I need the four 0s per 448x448 pixel for the RBGA values. EDIT: Hmm.. is an integer 0-255 a valid RBGA value? I know it's a valid RGB value, but also RGBA? I almost never use images in Java, so not too familiar with them. I simply based my 4 inner 0s on other answers. \$\endgroup\$ Commented Mar 13, 2019 at 9:31
  • \$\begingroup\$ Yes, four 0s as (in hexadecimal) 0x00000000 that fit on an int. The first 2 hex digits are the Alpha, the next 2 are the red, the next 2 are the green, the final 2 are the blue.So you only need an integer. See BufferedImage.TYPE_INT_ARGB. You have 4 values, summarized as one integer. And 0x00000000 is equal to 0. \$\endgroup\$ Commented Mar 13, 2019 at 9:40
  • \$\begingroup\$ I think this is the first time in ~2 years here I've seen Java actually be competitive! \$\endgroup\$
    – Shaggy
    Commented Mar 15, 2019 at 22:55
  • \$\begingroup\$ @Shaggy With these golfing languages around it's still not that competitive.. Besides, I had a few other semi-competitive Java answers in the past, like this one, or this one that was winning until the Bash showed up (and R golfed its answer). \$\endgroup\$ Commented Mar 16, 2019 at 10:47
6
\$\begingroup\$

Java 8


Saving the image to a file with path s, 101 bytes

s->javax.imageio.ImageIO.write(new java.awt.image.BufferedImage(448,448,2),"png",new java.io.File(s))

Try it online... somehow

Returning the BufferedImage, 46 bytes

v->new java.awt.image.BufferedImage(448,448,2)

Saving the image to the file f, 83 bytes

f->javax.imageio.ImageIO.write(new java.awt.image.BufferedImage(448,448,2),"png",f)

Dumping PNG to STDOUT, 92 bytes (thanks ASCII-only!)

v->javax.imageio.ImageIO.write(new java.awt.image.BufferedImage(448,448,2),"png",System.out)

Try it online!
Thanks to Kevin for saving a byte for the second and fourth solutions!

\$\endgroup\$
12
  • 2
    \$\begingroup\$ Do you mean empty or transparent? \$\endgroup\$
    – user9207
    Commented Mar 12, 2019 at 20:43
  • 1
    \$\begingroup\$ Just write to stdout \$\endgroup\$
    – ASCII-only
    Commented Mar 12, 2019 at 23:39
  • 1
    \$\begingroup\$ @ASCII-only So, write an empty (filled with zeros) 448*448*4 array to stdout? Anyways I like the idea of creating an actual PNG file. \$\endgroup\$ Commented Mar 13, 2019 at 0:45
  • 1
    \$\begingroup\$ You can golf the ()-> in two of your answers to v->, since it's allowed to have an empty unused input (for which I personally use Void). Your last TIO would then be this instead. \$\endgroup\$ Commented Mar 13, 2019 at 10:58
  • 1
    \$\begingroup\$ @NahuelFouilleul because I want to output an actual image and not a pixel by pixel representation of one \$\endgroup\$ Commented Mar 13, 2019 at 14:01
6
\$\begingroup\$

05AB1E, 12 10 9 bytes

448LDδ4Å0

Try it online.

or alternatively:

¾4Ž1ÂDиии

Try it online.

-2 bytes thanks to @Emigna.
-1 byte thanks to @Adnan.

Outputs a 448x448x4 3D list of 0s.

Explanation:

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)

See this 05AB1E answer of mine (section How to compress large integers?) to understand why Ž1Â is 448.

\$\endgroup\$
5
\$\begingroup\$

Processing, 66 bytes

PGraphics g=createGraphics(448,448);g.beginDraw();g.save("a.png");
\$\endgroup\$
5
\$\begingroup\$

Python 2.7, 17 Bytes (22 With Print)

[[[0]*4]*488]*488

With Print:

print[[[0]*4]*488]*488

As variable:

x=[[[0]*4]*488]*488

As an array of RGBA is allowed, that is what I have created above, defaulting to all 0's - meaning black, but totally transparent.

Try it online!

\$\endgroup\$
3
  • \$\begingroup\$ Again, with this one, just multiply manually and you get [0]*802816 that should also work. \$\endgroup\$ Commented Mar 13, 2019 at 11:26
  • 1
    \$\begingroup\$ @JohnHamilton Correct me if I'm wrong, but I do believe that it would have to be a 3D array (An array of rows of pixels) i.e. array[pixel x coord][pixel y coord][r/g/b/a] \$\endgroup\$ Commented Mar 13, 2019 at 12:27
  • 1
    \$\begingroup\$ Not quite as concise but here is an alternative that gets the zeros into a numpy array... np.zeros([4]+[448]*2) \$\endgroup\$ Commented Mar 14, 2019 at 0:53
5
\$\begingroup\$

HTML, 25 bytes

Is this valid?

<svg height=448 width=448

Test it (background applied with CSS so you can "see" it)

\$\endgroup\$
3
  • \$\begingroup\$ I don't believe that this is valid, as writting <svg height=448 width=448 into an html file and opening it produces an empty <body>. However, with the penality of 1 byte, if you write <svg height=448 width=448>, it produces a <body> with an empty SVG image. \$\endgroup\$ Commented Mar 15, 2019 at 10:43
  • \$\begingroup\$ @IsmaelMiguel, we define languages by their interpreter rather than their (intended) implementation. That an interpreter exists (in this case CodePen) that allows us to omit the closing > means that this is, indeed, valid, as far as the markup goes. \$\endgroup\$
    – Shaggy
    Commented Mar 15, 2019 at 11:01
  • 1
    \$\begingroup\$ Codepen adds additional HTML code to make it work. It adds a <!DOCTYPE html>, <html>, <head>, <style>, <script> and everything goes to the <body>. Some of the additional code is required to produce the desired output. You can see that the resulting code is parsed as <svg height="448" width="448" < body></svg>, because it writes <svg height=448 width=448 </body> in the iframe. As such, I still believe it isn't valid. \$\endgroup\$ Commented Mar 15, 2019 at 11:10
5
\$\begingroup\$

C# (Visual C# Interactive Compiler), 21 bytes

_=>new int[448,448,4]

Try it online!

\$\endgroup\$
5
\$\begingroup\$

Rust - 206 201 168 bytes

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);}

This writes an actual, readable o.tga file, without any libraries or builtin functions, using the TGA binary format per http://paulbourke.net/dataformats/tga/ , by hard coding the width and height into the binary file header.


-5 bytes shorten filename, fix img size, @ASCII-only

\$\endgroup\$
13
  • \$\begingroup\$ does it need to be printed to a file though :P \$\endgroup\$
    – ASCII-only
    Commented Mar 13, 2019 at 1:04
  • \$\begingroup\$ does it even need to be 2 dimensional? I could just say [0;444*444*4]; and say i created a 444x444 transparent image. im making it interesting. \$\endgroup\$
    – don bright
    Commented Mar 13, 2019 at 3:24
  • \$\begingroup\$ well also a would work as file name would it not. btw it's 448*448 not 444*444 so this is invalid \$\endgroup\$
    – ASCII-only
    Commented Mar 13, 2019 at 3:29
  • \$\begingroup\$ oops, ha ha thanks \$\endgroup\$
    – don bright
    Commented Mar 13, 2019 at 3:34
  • \$\begingroup\$ to make it even more interesting, run length encode it :P (image data should be [255,0,0,0,0] 6272 times ([0,0,0,0] 128 times, repeated 6272 times). image type would then be 10 not 2. even better, colormap for shorter run length encoding (0,0,0,0 -> 0) \$\endgroup\$
    – ASCII-only
    Commented Mar 13, 2019 at 3:35
5
\$\begingroup\$

dzaima/APL + APLP5, 18 16 bytes

{P5.img⍴∘0,⍨448}

Function that outputs an image object that can be drawn to the screen (for no effect) or converted back to pixel values.

-2 thanks to ngn!

\$\endgroup\$
2
  • \$\begingroup\$ would this work? {P5.img⍴∘0,⍨448} \$\endgroup\$
    – ngn
    Commented Mar 15, 2019 at 11:18
  • \$\begingroup\$ @ngn it indeed would, thanks! \$\endgroup\$
    – dzaima
    Commented Mar 15, 2019 at 11:22
4
\$\begingroup\$

C# (Visual C# Interactive Compiler), 48 bytes

_=>(Enumerable.Repeat((0,0,0,0),200704),448,448)

Apparently outputting [1D array of pixels, width, height] is ok, so this outputs a tuple of `(IEnumerable of pixels, width, height).

Try it online!

C# (Visual C# Interactive Compiler), 58 bytes

_=>Enumerable.Repeat(Enumerable.Repeat((0,0,0,0),448),448)

The original matrix returning answer.

Since the image IO rules allow output as a matrix of RGB values, this submission outputs a matrix of RGBA values, represented by tuples with four values, all being 0.

Try it online!

\$\endgroup\$
4
\$\begingroup\$

PHP, 192 bytes

Sadly, PHP kinda sucks in that aspect because it requires a whole lot of code. But then again, where doesn't PHP suck.

$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');

Ungolfed:

$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

Obviously, if you just want to create it without outputting it, you can omit the header() and readfile() commands. Still, it's idiotically long.

\$\endgroup\$
5
  • 1
    \$\begingroup\$ on the positive side, this is one of the most 'readable' answers that indicates exactly what its doing \$\endgroup\$
    – don bright
    Commented Mar 15, 2019 at 4:37
  • \$\begingroup\$ @donbright Not really the point of codegolfing tho. ;P However, there is no other way to do this in PHP I guess, unless I just echo some HTML. \$\endgroup\$ Commented Mar 15, 2019 at 10:05
  • \$\begingroup\$ @YUNOWORK According to the rules, you can export an array. You can use '<?php return '.var_export(array_fill(0,952576,0),1).';'; to export the array in an executable way. you can do php -f image.php > array.php, and somewhere else you can do $array = include('array.php'); to have an usable array again. But I don't know if it is valid, so, I'm giving it to you to add as an alternative. Or even a <?=json_encode(array_fill(0,952576,0));. \$\endgroup\$ Commented Mar 15, 2019 at 15:18
  • \$\begingroup\$ By the way, true can be replaced with 1, to save 3 bytes. Reading the documentation of imagepng(), you can just do header('Content-type: image/png');imagepng($i);. I believe you can also replace $b=imagecolorallocatealpha($i,0,0,0,127);imagefill($i,0,0,$b); with imagefill($i,0,0,imagecolorallocatealpha($i,0,0,0,127)); but dont quote me on that. \$\endgroup\$ Commented Mar 15, 2019 at 16:29
  • \$\begingroup\$ I just tested and <? imagecolorallocatealpha($i=imagecreate(448,448),0,0,0,127);header('Content-type: image/png');imagepng($i); produces a transparent image (109 bytes). Automatically sends the image to the browser/standard output and everything. \$\endgroup\$ Commented Mar 15, 2019 at 17:44
4
\$\begingroup\$

Python 3.7 - PIL Imported, 30 bytes

Image.new("LA",[448]*2).show()

This requires an import but has the benefit of creating and displaying an actual image file rather than an abstract empty array.

Explanation:

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() will open the image in your default image program. In my case this opens a temporary bitmap file in Windows Photo Viewer but results may vary. Arguably this is cheating since the bitmap representation contains no transparency

Variations...

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
\$\endgroup\$
4
  • 1
    \$\begingroup\$ If you do not count your import, you should state your language as Python 3.7 -- PIL imported or something similar. Furthermore, in your explanation you capitalize Import. \$\endgroup\$ Commented Mar 14, 2019 at 0:53
  • \$\begingroup\$ Thanks, corrected. Should I give my answer as 24 bytes, 30 or 37? \$\endgroup\$ Commented Mar 14, 2019 at 0:57
  • \$\begingroup\$ The byte count depends on the language you use. As of now, your submission takes 30 bytes in the language Python 3 with PIL imported. If you wrote in Python 3, it would most likely be longer. Of course, if you use the language Python 3 with the entire PIL namespace imported, your answer would be new("LA",[448]*2).show(), 26 bytes. \$\endgroup\$ Commented Mar 14, 2019 at 2:11
  • \$\begingroup\$ Thanks so much for submitting code I can actually run and which produces output I can test! \$\endgroup\$
    – user9207
    Commented Mar 14, 2019 at 10:42
4
\$\begingroup\$

MATLAB, 31 bytes

imwrite(nan(448),'.png','tr',1)

Creates a 448 x 448 matrix of NaN values, and then uses imwrite to save them to a PNG file named '.png' and sets the transparency to 1, making it transparent. The 'Transparency' parameter name is able to be abbreviated to 'tr' as MATLAB allows for partial string matching of parameter names as long as the shortened version is unique among available parameters.

\$\endgroup\$
3
  • \$\begingroup\$ wait, why 443?? \$\endgroup\$
    – ASCII-only
    Commented Mar 14, 2019 at 12:58
  • \$\begingroup\$ @ASCII-only Fat fingers :) \$\endgroup\$
    – Suever
    Commented Mar 14, 2019 at 12:59
  • \$\begingroup\$ O_o that was an insanely quick reply \$\endgroup\$
    – ASCII-only
    Commented Mar 14, 2019 at 12:59
3
\$\begingroup\$

Jelly, 10 9 bytes

x4Wẋ448Ɗ⁺

Try it online!

Outputs a 448x448x4 array

Thanks to @JonathanAllan for saving a byte.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ can be \$\endgroup\$ Commented Mar 12, 2019 at 21:33
3
\$\begingroup\$

Red, 33 bytes

a: make image![448x448 0.0.0.255]

Opacity defaults to fully opaque(0)

This is how to use it /a full program/ :

Red [ ]
a: make image! [ 448x448 0.0.0.255 ]
view [ image a ]
\$\endgroup\$
0
3
\$\begingroup\$

MathGolf, 10 bytes

º4♦7*_ß{.a

Try it online!

Explanation

º            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

This method saves 1 byte compared to the "standard" ♦7*_4º*a*a*

\$\endgroup\$
3
\$\begingroup\$

JavaScript (Node.js), 39 bytes

_=>[w=448,w,Array(w*w).fill([0,0,0,0])]

Apparently outputting [height, width, 1d array of RGBA values] is ok.

Try it online!

-3 bytes thanks to @Arnauld

\$\endgroup\$
4
  • \$\begingroup\$ invalid... it's a list of strings \$\endgroup\$
    – ASCII-only
    Commented Mar 13, 2019 at 2:20
  • \$\begingroup\$ Also you can output [1D array of pixels, width, height] \$\endgroup\$
    – ASCII-only
    Commented Mar 13, 2019 at 2:21
  • \$\begingroup\$ @ASCII-only Fixed now \$\endgroup\$
    – Gymhgy
    Commented Mar 13, 2019 at 2:24
  • \$\begingroup\$ 41 bytes or 39 bytes if we can output [width, height, array]. \$\endgroup\$
    – Arnauld
    Commented Mar 13, 2019 at 8:09
3
\$\begingroup\$

SmileBASIC, 27 bytes

DIM A[448,448]SAVE"DAT:I",A

Saves a 2-dimensional 448x448 array filled with 0s to a file named DAT:I (Which is shorter than defining a function that returns the array, somehow)

The standard formats (used by all graphics functions) for colors in SmileBASIC are 32 bit ARGB and 16 bit 5551 RGBA, and 0 is transparent in both of them.

\$\endgroup\$
7
  • \$\begingroup\$ What makes this transparent instead of black? \$\endgroup\$
    – pipe
    Commented Mar 13, 2019 at 13:38
  • 1
    \$\begingroup\$ The colors are in 4 byte ARGB format (commonly used in Smilebasic), so 0x00000000 is Alpha = 0, Red = 0, Green = 0, Blue = 0. Black would be 0xFF000000. \$\endgroup\$
    – 12Me21
    Commented Mar 13, 2019 at 15:38
  • \$\begingroup\$ kudos to SmileBasic for using a RAW image format lol \$\endgroup\$
    – don bright
    Commented Mar 14, 2019 at 1:57
  • \$\begingroup\$ I would complain on technicality that this isn't an image format since it isn't GRP but I'll let it go since the actual data being stored is the same. \$\endgroup\$
    – snail_
    Commented Mar 14, 2019 at 7:02
  • \$\begingroup\$ @snail_ It's just outputting a matrix of pixels, not using a specific image format. \$\endgroup\$
    – 12Me21
    Commented Mar 14, 2019 at 8:23
3
\$\begingroup\$

ScPL for iOS Shortcuts, 98 bytes

Text"R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"
Base64Encode Decode
ResizeImage 448

Screenshot

Shortcut iCloud Link

Takes a 1x1 transparent gif encoded as base64 and resizes it

\$\endgroup\$
2
  • \$\begingroup\$ that was ... weird... what is the icloud link i just went to? ? \$\endgroup\$
    – don bright
    Commented Mar 15, 2019 at 4:37
  • \$\begingroup\$ @donbright when you share a shortcut from the shortcuts app, it makes that link \$\endgroup\$
    – pfg
    Commented Mar 15, 2019 at 14:29
2
\$\begingroup\$

Jstx, 24 bytes

♪☺ü@/øP♦£Q)%)£Q◄úæD)%)£Q

Explanation

♪☺ü@ # 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.

Try it online!

\$\endgroup\$
2
\$\begingroup\$

R, 21 bytes

array(0,c(448,448,4))

Try it online!

Returns a 3D-array of zeroes.

\$\endgroup\$
2
\$\begingroup\$

Japt, 9 bytes

448ÆZç4Æ0

Try it online!

\$\endgroup\$
2
\$\begingroup\$

C++, SFML, 131 bytes

#include <SFML/Graphics.hpp>
void f(){sf::Image i;i.create(448,448);i.createMaskFromColor(sf::Color::Black);i.saveToFile("a.png");}
\$\endgroup\$
2
\$\begingroup\$

JavaScript + HTML, 56 bytes

location=C.toDataURL()
<canvas id=C width=448 height=448>

Clicking "Run code snippet" will generate a 448x448 transparent PNG in an IFRAME. You may then right-click "Save image as..." to download it to your computer.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.