Not clear. Image 1 is a plain image where all pixels are black (R=G=B=0) (except a few red lines RGB=(255,0,0)) and opaque (A=255). Image 2 is an image where everything is black (R=G=B=0) but also transparent (A=0).
A PNG contains either 3 (RGB) or 4 (RGBA) channels, so "exporting the alpha channel" is part of exporting the image.
Unless your problem is that you are forcing the export to 8bpc RGB and not to 8bpc RGBA thus explicitly dropping the alpha channel. if you export with automatic pixelformat, you should also get 8pbc RGBA if your layer has an alpha channel.
A PNG contains either 3 (RGB) or 4 (RGBA) channels, so "exporting the alpha channel" is part of exporting the image.
Unless your problem is that you are forcing the export to 8bpc RGB and not to 8bpc RGBA thus explicitly dropping the alpha channel. if you export with automatic pixelformat, you should also get 8pbc RGBA if your layer has an alpha channel.