Make a transparent 448*448 image

10

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.

Anush

Posted 2019-03-12T18:59:18.977

Reputation: 3 202

7What's to stop people from submitting a 0-byte answer which "outputs" a transparent (invisible) image to the screen? – 12Me21 – 2019-03-12T20:56:28.883

9@12Me21 Would that be 448*448? – Anush – 2019-03-13T09:21:43.880

2Is this a parody of (or at least inspired by) a closed question on stackoverflow? – Foon – 2019-03-13T20:38:15.193

2What's special about 448 px? – dan04 – 2019-03-13T22:12:13.643

@dan04 CDXLVIII is the number of integer partitions of 33 into distinct parts. It also cannot be written as a sum of 3 squares. – Anush – 2019-03-13T22:17:40.060

1@Foon Definitely not a parody but certainly I was interested enough to ask on SO before realising it would be much more fun here. – Anush – 2019-03-13T22:18:43.457

Answers

28

Imagemagick in some shell, 35

convert -size 448x448 xc:none a.png

Is this allowed?

vityavv

Posted 2019-03-12T18:59:18.977

Reputation: 734

Oh! I had no idea this would work. It's surprising and clever, so yes! – Anush – 2019-03-12T20:23:31.810

Please specify the shell – ASCII-only – 2019-03-12T23:39:38.330

5Bash, I guess? That's what I used when I tested it. Any POSIX shell should work? – vityavv – 2019-03-13T02:20:16.267

3Works also in Windows (if ImageMagick is in the PATH before \windows\system32). – CL. – 2019-03-13T07:48:41.310

1On Windows ImageMagick is not being shipped with convert tool, because the name clashes with system utility. You run magick convert ... instead. – n0rd – 2019-03-14T06:05:48.347

I believe since convert is the language you wish to use, you only need to calculate the parameters as part of the byte count, so only the -size 448x448 xc:none a.png part. This is from the rule that non-standard parameters count in the byte count - but the filename itself shouldn't – SztupY – 2019-03-14T11:31:25.820

1@SztupY the convert is part of ImageMagick, so calling it its own language would not work. – vityavv – 2019-03-14T14:35:06.403

1it'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 – SztupY – 2019-03-14T14:52:31.727

15

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

Adám

Posted 2019-03-12T18:59:18.977

Reputation: 37 779

I don't know APL at all, but I guess it doesn't have a duplicate to golf the 448 448? – Kevin Cruijssen – 2019-03-13T08:24:44.767

448*448=200704, so cant you replace the space separated 448 448 with 200704, saving 1 byte? – NaCl – 2019-03-13T09:35:14.710

1@NaCl In that case why not just multiply that by 4 and have 802832p0 as the answer? – John Hamilton – 2019-03-13T11:25:33.007

@NaCl Because that's not one of the valid image formats per default rules.

– Adám – 2019-03-13T12:32:13.167

@JohnHamilton For the same reason as my answer to NaCl.

– Adám – 2019-03-13T12:32:42.517

ironically that is how images are stored in most graphics image systems, as a one dimensional array – don bright – 2019-03-14T01:58:26.403

8

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

vityavv

Posted 2019-03-12T18:59:18.977

Reputation: 734

2Call it a Go-lf. – Skyler – 2019-03-14T19:24:11.813

6

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!

Benjamin Urquhart

Posted 2019-03-12T18:59:18.977

Reputation: 1 262

2Do you mean empty or transparent? – Anush – 2019-03-12T20:43:06.100

I'm pretty sure empty pngs are transparent, are they not? I typed this up on my phone so I can't check – Benjamin Urquhart – 2019-03-12T20:44:58.867

1Just write to stdout – ASCII-only – 2019-03-12T23:39:08.023

1@ASCII-only So, write an empty (filled with zeros) 4484484 array to stdout? Anyways I like the idea of creating an actual PNG file. – Benjamin Urquhart – 2019-03-13T00:45:39.000

@BenjaminUrquhart no i mean write the bytestream to stdout, you can just redirect in the stream anyway – ASCII-only – 2019-03-13T01:01:15.307

like this. also you could use bash on TIO to verify your existing solution works – ASCII-only – 2019-03-13T01:02:46.200

@ASCII-only I didn't know ImageIO.write accepted streams. Guess it makes sense – Benjamin Urquhart – 2019-03-13T01:48:12.617

1

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.

– Kevin Cruijssen – 2019-03-13T10:58:09.817

what about 24 bytes output as 3d array rows, cols, rgba. like Python answer

– Nahuel Fouilleul – 2019-03-13T13:54:57.870

1@NahuelFouilleul because I want to output an actual image and not a pixel by pixel representation of one – Benjamin Urquhart – 2019-03-13T14:01:26.433

Thank you for outputting an actual image! – Anush – 2019-03-14T10:43:33.337

@Anush you're welcome – Benjamin Urquhart – 2019-03-15T18:56:47.967

6

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.

Neil

Posted 2019-03-12T18:59:18.977

Reputation: 95 035

171 bytes? – Shaggy – 2019-03-12T23:30:05.177

2document.createElement\canvas` ` should work, saving 2 more bytes. – Arnauld – 2019-03-12T23:31:34.207

1If createelement is valid would seeing document.body and using the fact an id becomes a variable be valid? Also stack snippet pls – ASCII-only – 2019-03-12T23:37:59.973

1Could you add something like d=document at the top and replace document with d? Should save ~5 characters. – Luke – 2019-03-14T14:07:12.167

1@Luke The document.write is just part of the stack snippet, not part of the function, so it doesn't count anyway. – Neil – 2019-03-14T14:21:54.810

6

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.

Kevin Cruijssen

Posted 2019-03-12T18:59:18.977

Reputation: 67 575

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. – Olivier Grégoire – 2019-03-13T09:27:10.023

@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. – Kevin Cruijssen – 2019-03-13T09:31:52.163

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.

– Olivier Grégoire – 2019-03-13T09:40:50.480

I think this is the first time in ~2 years here I've seen Java actually be competitive! – Shaggy – 2019-03-15T22:55:31.910

@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).

– Kevin Cruijssen – 2019-03-16T10:47:34.383

6

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.

Kevin Cruijssen

Posted 2019-03-12T18:59:18.977

Reputation: 67 575

5

Processing, 66 bytes

PGraphics g=createGraphics(448,448);g.beginDraw();g.save("a.png");

dzaima

Posted 2019-03-12T18:59:18.977

Reputation: 19 048

5

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!

Snaddyvitch Dispenser

Posted 2019-03-12T18:59:18.977

Reputation: 101

Again, with this one, just multiply manually and you get [0]*802816 that should also work. – John Hamilton – 2019-03-13T11:26:59.340

1@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] – Snaddyvitch Dispenser – 2019-03-13T12:27:47.140

1Not quite as concise but here is an alternative that gets the zeros into a numpy array... np.zeros([4]+[448]*2) – P. Hopkinson – 2019-03-14T00:53:28.947

5

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]

Jonathan Allan

Posted 2019-03-12T18:59:18.977

Reputation: 67 804

5

HTML, 25 bytes

Is this valid?

<svg height=448 width=448

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

Shaggy

Posted 2019-03-12T18:59:18.977

Reputation: 24 623

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. – Ismael Miguel – 2019-03-15T10:43:55.290

@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. – Shaggy – 2019-03-15T11:01:57.667

1Codepen 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. – Ismael Miguel – 2019-03-15T11:10:19.707

5

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

don bright

Posted 2019-03-12T18:59:18.977

Reputation: 1 189

does it need to be printed to a file though :P – ASCII-only – 2019-03-13T01:04:06.920

does it even need to be 2 dimensional? I could just say [0;4444444]; and say i created a 444x444 transparent image. im making it interesting. – don bright – 2019-03-13T03:24:32.787

well also a would work as file name would it not. btw it's 448448 not 444444 so this is invalid – ASCII-only – 2019-03-13T03:29:18.833

oops, ha ha thanks – don bright – 2019-03-13T03:34:20.250

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) – ASCII-only – 2019-03-13T03:35:48.780

i think that would take more space than my version. – don bright – 2019-03-13T03:39:07.800

of course, but you said you wanted to make it interesting :P (rle colormapped should be something like [0,1,9,0,0,1,0,32,0,0,0,0,192,1,192,1,32,0,0,0,0,0] and [255,0] 6272 times btw). also, i wonder if you could make the first one a string? (escaping things like 0 -> \0 and/or 2 -> \x02 if you need to) – ASCII-only – 2019-03-13T03:39:34.703

i couldnt figure out how the string version would be shorter. – don bright – 2019-03-13T04:07:48.113

You could make every value 1 byte, with no delimiter ad well, of course this assumes 0x00 is valid in a rust file and that strings have iter – ASCII-only – 2019-03-13T04:25:35.713

i am not aware of how to do it at the current moment. rust strings are like, literally, utf8. ill try some things though – don bright – 2019-03-14T01:11:17.940

the problem with string encoding is that its not easily convertible to bytes, any way i can figure to do it will take up more space than just having the vector of bytes separated by commas. – don bright – 2019-03-14T01:43:27.007

You could save quite a lot if you sent it to the standard output: https://doc.rust-lang.org/std/io/fn.stdout.html and it is acceptable (most upvoted as well, in the meta): https://codegolf.meta.stackexchange.com/a/9095

– Ismael Miguel – 2019-03-15T12:49:48.840

5

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

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

Try it online!

Expired Data

Posted 2019-03-12T18:59:18.977

Reputation: 3 129

4

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!

Embodiment of Ignorance

Posted 2019-03-12T18:59:18.977

Reputation: 7 014

4

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!

dzaima

Posted 2019-03-12T18:59:18.977

Reputation: 19 048

would this work? {P5.img⍴∘0,⍨448} – ngn – 2019-03-15T11:18:59.507

@ngn it indeed would, thanks! – dzaima – 2019-03-15T11:22:12.947

4

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.

Y U NO WORK

Posted 2019-03-12T18:59:18.977

Reputation: 181

1on the positive side, this is one of the most 'readable' answers that indicates exactly what its doing – don bright – 2019-03-15T04:37:53.537

@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. – Y U NO WORK – 2019-03-15T10:05:48.303

@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));. – Ismael Miguel – 2019-03-15T15:18:50.133

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. – Ismael Miguel – 2019-03-15T16:29:42.627

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. – Ismael Miguel – 2019-03-15T17:44:34.647

4

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

P. Hopkinson

Posted 2019-03-12T18:59:18.977

Reputation: 141

1If 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. – Jonathan Frech – 2019-03-14T00:53:00.687

Thanks, corrected. Should I give my answer as 24 bytes, 30 or 37? – P. Hopkinson – 2019-03-14T00:57:27.513

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. – Jonathan Frech – 2019-03-14T02:11:39.703

Thanks so much for submitting code I can actually run and which produces output I can test! – Anush – 2019-03-14T10:42:41.887

4

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.

Suever

Posted 2019-03-12T18:59:18.977

Reputation: 10 257

wait, why 443?? – ASCII-only – 2019-03-14T12:58:52.680

@ASCII-only Fat fingers :) – Suever – 2019-03-14T12:59:17.203

O_o that was an insanely quick reply – ASCII-only – 2019-03-14T12:59:35.900

3

Jelly, 10 9 bytes

x4Wẋ448Ɗ⁺

Try it online!

Outputs a 448x448x4 array

Thanks to @JonathanAllan for saving a byte.

Nick Kennedy

Posted 2019-03-12T18:59:18.977

Reputation: 11 829

1 can be – Jonathan Allan – 2019-03-12T21:33:40.107

3

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

Embodiment of Ignorance

Posted 2019-03-12T18:59:18.977

Reputation: 7 014

invalid... it's a list of strings – ASCII-only – 2019-03-13T02:20:31.997

Also you can output [1D array of pixels, width, height] – ASCII-only – 2019-03-13T02:21:32.340

@ASCII-only Fixed now – Embodiment of Ignorance – 2019-03-13T02:24:03.153

41 bytes or 39 bytes if we can output [width, height, array]. – Arnauld – 2019-03-13T08:09:43.867

3

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.

12Me21

Posted 2019-03-12T18:59:18.977

Reputation: 6 110

What makes this transparent instead of black? – pipe – 2019-03-13T13:38:32.343

1The 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. – 12Me21 – 2019-03-13T15:38:16.770

kudos to SmileBasic for using a RAW image format lol – don bright – 2019-03-14T01:57:04.597

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. – snail_ – 2019-03-14T07:02:37.173

@snail_ It's just outputting a matrix of pixels, not using a specific image format. – 12Me21 – 2019-03-14T08:23:30.217

@12Me21 It's valid according to PPCG – ASCII-only – 2019-03-15T00:23:09.720

raw pixel data is sometimes referred to as a raw image format, and a lot of cameras provide a raw pixel buffer data file. Photoshop can even read certain types of raw image formats. Unity3d can also use it for heightmaps – don bright – 2019-03-15T04:35:27.483

3

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 ]

Galen Ivanov

Posted 2019-03-12T18:59:18.977

Reputation: 13 815

3

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*

maxb

Posted 2019-03-12T18:59:18.977

Reputation: 5 754

3

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

pfg

Posted 2019-03-12T18:59:18.977

Reputation: 735

that was ... weird... what is the icloud link i just went to? ? – don bright – 2019-03-15T04:37:12.417

@donbright when you share a shortcut from the shortcuts app, it makes that link – pfg – 2019-03-15T14:29:33.227

2

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!

Quantum64

Posted 2019-03-12T18:59:18.977

Reputation: 371

2

R, 21 bytes

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

Try it online!

Returns a 3D-array of zeroes.

Kirill L.

Posted 2019-03-12T18:59:18.977

Reputation: 6 693

2

Japt, 9 bytes

448ÆZç4Æ0

Try it online!

Oliver

Posted 2019-03-12T18:59:18.977

Reputation: 7 160

2

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

HatsuPointerKun

Posted 2019-03-12T18:59:18.977

Reputation: 1 891

2

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.

dana

Posted 2019-03-12T18:59:18.977

Reputation: 2 541