Skip to main content
replaced http://codegolf.stackexchange.com/ with https://codegolf.stackexchange.com/
Source Link

Yes, another BPG solution. I think this basically serves to prove that BPG is the best image compression utility currently available. Consider it an improvement over yallie's original BPG solutionyallie's original BPG solution.

Yes, another BPG solution. I think this basically serves to prove that BPG is the best image compression utility currently available. Consider it an improvement over yallie's original BPG solution.

Yes, another BPG solution. I think this basically serves to prove that BPG is the best image compression utility currently available. Consider it an improvement over yallie's original BPG solution.

added 465 characters in body
Source Link
nneonneo
  • 12.6k
  • 8
  • 31
  • 52

program outputstarry night approximation from bpgdec

I find it rather amazing that bpg, in a mere 996 bytes, has accurately reconstructed the sharp contours of the tree, on the left, and the hills on the right. It even has a passable approximation for the church steeple! The level of detail is very impressive (to me) for the small filesize. Of course, bpgdec itself is not a small program, but it's clear to me that BPG is an order of magnitude better than JPEG for image compression.

program output

starry night approximation from bpgdec

I find it rather amazing that bpg, in a mere 996 bytes, has accurately reconstructed the sharp contours of the tree, on the left, and the hills on the right. It even has a passable approximation for the church steeple! The level of detail is very impressive (to me) for the small filesize. Of course, bpgdec itself is not a small program, but it's clear to me that BPG is an order of magnitude better than JPEG for image compression.

compatibility
Source Link
nneonneo
  • 12.6k
  • 8
  • 31
  • 52

The file is 10221024 bytes long, which squeezes it in just underright at the 1024-byte limit. It consists of the line

exec bpgdec =(tail +2-n+2 $0)

(note that In hex, this means the script file contains all sorts of non-ASCII characters!)

Here'sis the full script, base64-encoded:

ZXhlYyBicGdkZWMgPSh0YWlsICsyICQwKQpCUEf7cACDAoJAAAOSQlADkkJQRAnBkJWBEgAAAAFEAcGQ0000000: 6578 6563 2062 7067 6465 6320 3d28 7461  exec bpgdec =(ta
lYEWA3AAAAEmCa4LMOdgFmqXmtNBko/QcAAAAwAAAwAAAwAAAwAAAwAABMwAAAEmAa8FmP2ZkfnovyIg0000010: 696c 202d 6e2b 3220 2430 290a 4250 47fb  il -n+2 $0).BPG.
ee9K0oPqUXvW7OF81Z1LPeoWgqO/o7j2XHUcVclZ0eLPE+EMGD8klWDAW2WXH458RT2y5PqAidz15AAQ0000020: 7000 8302 8240 0003 9242 5003 9242 5044  [email protected]
g0dNOrsHW6qV86xS7KFOKjRSFJO4lun7TV9GBQu/FPbsAEKRBdYmO/UkoyFhPK2JBtdJgynZ8dJ6zFVQ0000030: 09c1 9095 8112 0000 0001 4401 c190 9581  ..........D.....
ZdPzO9GV7t2lCZdQ+a68vPO1M4DI2wwb6TIaUi0Q93r5Z15ip2Z+5KB2qFvaz0F3MTYKc2K1dtLvxF3g0000040: 1603 7000 0001 2609 ae0b 30e7 6016 6a97  ..p...&...0.`.j.
+abqStFafnsOMX8GhR2izwaAEU9Xu3R3Qhc0tq+uccACDrTqByU0jn3WAPetu/fVwvw+NoE4JCAXUc9a0000050: 9ad3 4192 8fd0 7000 0003 0000 0300 0003  ..A...p.........
y4pvsQ4m1fhd9s3DB7V23SWTFw/ptwfbrWM3RpY59weFgSoWuaE1Y8KSoRLXwS0llGGZxJkO+RcjRtxv0000060: 0000 0300 0003 0000 04cc 0000 0126 01af  .............&..
UaX9wDpEL0+wyRXpfYjThkeqtwXpfPLuxBngeJqjtXRkWmMaZ4q3x25pS9To37ZX1W6TUYdQY8IUHOO70000070: 0598 fd99 91f9 e8bf 2220 79ef 4ad2 83ea  ........" y.J...
gwUzrTNiCOjUsMWor2eWlWOgrpam/QChAQXspdueJ87S+8jqdFcvOF/QCAoqx0kZa2pCTe8eAsQ2B94x0000080: 517b d6ec e17c d59d 4b3d ea16 82a3 bfa3  Q{...|..K=......
fA98sMkKYJu7wXrljRd/00BujfeB+PtRc2a+svtiUeNYzlXViiimO3sxDt69wp0TBKLAOd6TY41saMPT0000090: b8f6 5c75 1c55 c959 d1e2 cf13 e10c 183f  ..\u.U.Y.......?
52I27Urio754GxUKe4KfCwoUF7et4Wh6yE9aL4jRoUF2/r97wiBhiYQk1+M1lYgvHsmjYzUBMFb2+dzt00000a0: 2495 60c0 5b65 971f 8e7c 453d b2e4 fa80  $.`.[e...|E=....
KzdzO4ZZ9emT+fpbQZrLeODv17Qeg3/OQ4N+7hCvK6oUResG11xCIFP5NP12wCEX+Rbzt/WZCXclYghd00000b0: 89dc f5e4 0010 8347 4d3a bb07 5baa 95f3  .......GM:..[...
otR0wS5sCiFcz2qfwEWR4N5mKa/eJ68r9nOMtbLqsHAx/bgfjbGOJTJDMaDKCOgB5LbfckApFrKnEn7k00000c0: ac52 eca1 4e2a 3452 1493 b896 e9fb 4d5f  .R..N*4R......M_
wuasqvhM0X09RmXVgia9ZdpFPKyV2O0OEVN1hwns10VPULpMMUtKw7a3SWQe6OMhwCl64kYw/gXd0faO00000d0: 4605 0bbf 14f6 ec00 4291 05d6 263b f524  F.......B...&;.$
VkaFfej7YB5FP+U+/g0MXl2mSgP22cWbC3+y3vNUIbvAxYu536Hz5Xanu84XXswnEl00000e0: a321 613c ad89 06d7 4983 29d9 f1d2 7acc  .!a<....I.)...z.
00000f0: 5550 65d3 f33b d195 eedd a509 9750 f9ae  UPe..;.......P..
0000100: bcbc f3b5 3380 c8db 0c1b e932 1a52 2d10  ....3......2.R-.
0000110: f77a f967 5e62 a766 7ee4 a076 a85b dacf  .z.g^b.f~..v.[..
0000120: 4177 3136 0a73 62b5 76d2 efc4 5de0 f9a6  Aw16.sb.v...]...
0000130: ea4a d15a 7e7b 0e31 7f06 851d a2cf 0680  .J.Z~{.1........
0000140: 114f 57bb 7477 4217 34b6 afae 71c0 020e  .OW.twB.4...q...
0000150: b4ea 0725 348e 7dd6 00f7 adbb f7d5 c2fc  ...%4.}.........
0000160: 3e36 8138 2420 1751 cf5a cb8a 6fb1 0e26  >6.8$ .Q.Z..o..&
0000170: d5f8 5df6 cdc3 07b5 76dd 2593 170f e9b7  ..].....v.%.....
0000180: 07db ad63 3746 9639 f707 8581 2a16 b9a1  ...c7F.9....*...
0000190: 3563 c292 a112 d7c1 2d25 9461 99c4 990e  5c......-%.a....
00001a0: f917 2346 dc6f 51a5 fdc0 3a44 2f4f b0c9  ..#F.oQ...:D/dm63CzXnSwEPxO..
bfQgOtPEmyV00001b0: 15e9 7d88 d386 47aa b705 e97c f2ee c419  ..}...G....|....
00001c0: e078 9aa3 b574 645a 631a 678a b7c7 6e69  .x...tdZc.g...ni
00001d0: 4bd4 e8df b657 d56e 9351 8750 63c2 141c  K....W.n.Q.Pc...
00001e0: e3bb 8305 33ad 3362 08e8 d4b0 c5a8 af67  ....3.3b.......g
00001f0: 9695 63a0 ae96 a6fd 00a1 0105 eca5 db9e  ..c.............
0000200: 27ce d2fb c8ea 7457 2f38 5fd0 080a 2ac7  '.....tW/6hkFdiABv6R3jA6RRR0whtVZjX9ArXJgPskPWmLbCRFho2278_...*.
0000210: 4919 6b6a 424d ef1e 02c4 3607 de31 7c0f  I.kjBM....6..1|.
0000220: 7cb0 c90a 609b bbc1 7ae5 8d17 7fd3 406e  |...`...z.....@n
0000230: 8df7 81f8 fb51 7366 beb2 fb62 51e3 58ce  .....Qsf...bQ.X.
0000240: 55d5 8a28 a63b 7b31 0ede bdc2 9d13 04a2  U..(.;{1........
0000250: c039 de93 638d 6c68 c3d3 e762 36ed 4ae2  .9..c.lh...b6.J.
0000260: a3be 781b 150a 7b82 9f0b 0a14 17b7 ade1  ..x...{.........
0000270: 687a c84f 5a2f 88d1 a141 76fe bf7b c220  hz.OZ/AIKmDV...Av..{. 
0000280: 6189 8424 d7e3 3595 882f 1ec9 a363 3501  a..$..5../x6RoTDZRIAH8...c5.
cF5k1E5iPFJIpUL7Y2EkliH0000290: 3056 f6f9 dced 2b37 733b 8659 f5e9 93f9  0V....+7s;.Y....
00002a0: fa5b 419a cb78 e0ef d7b4 1e83 7fce 4383  .[A..x........C.
00002b0: 7eee 10af 2baa 1445 eb06 d75c 4220 53f9  ~...+..E...\B S.
00002c0: 34fd 76c0 2117 f916 f3b7 f599 0977 2562  4.v.!........w%b
00002d0: 085d a2d4 74c1 2e6c 0a21 5ccf 6a9f c045  .]..t..l.!\.j..E
00002e0: 91e0 de66 29af de27 af2b f673 8cb5 b2ea  ...f)..'.+.s....
00002f0: b070 31fd b81f 8db1 8e25 3243 31a0 ca08  .p1......%2C1...
0000300: e801 e4b6 df72 4029 16b2 a712 7ee4 c2e6  .....r@)....~...
0000310: acaa f84c d17d 3d46 65d5 8226 bd65 da45  ...L.}=Fe..&.e.E
0000320: 3cac 95d8 ed0e 1153 7587 09ec d745 4f50  <......Su....EOP
0000330: ba4c 314b 4ac3 b6b7 4964 1ee8 e321 c029  .L1KJ...Id...!.)
0000340: 7ae2 4630 fe05 ddd1 f68e 5646 857d e8fb  z.F0......VF.}..
0000350: 601e 453f e53e fe0d 0c5e 5da6 4a03 f6d9  `.E?.>...^].J...
0000360: c59b 0b7f b2de f354 21bb c0c5 8bb9 dfa1  .......T!.......
0000370: f3e5 76a7 bbce 175e cc27 125f dd9b adc2  ..v....^.'._....
0000380: cd79 d2c0 43f1 6df4 203a d3c4 9b25 7fea  .y..C.m. :...%..
0000390: 1905 7620 01bf a477 8c0e 9145 1d30 86d5  ..v ...w...E.0..
00003a0: 598d 7f40 ad72 603e c90f 5a62 db09 1161  [email protected]`>..Zb...a
00003b0: a36d bbfc 020a 9835 7fc7 a468 4c36 5120  .m.....5...hL6Q 
00003c0: 01fc 705e 64d4 4e62 3c52 48a5 42fb 6361  ..p^d.Nb<RH.B.ca
00003d0: 2496 21ff 321b 2b7b 3016 7a56 1ea6 18f9  $.!.2.+{0.zV....
00003e0: e52f 318a 80cb 237c f3c8 a46c b747 794e  ./MhsrezAWelYephj55S8xioDLI3zzyKRst0d5TujBd8J+s+9bYPutA6Tm1...#|...l.GyN
7kA=00003f0: e8c1 77c2 7eb3 ef5b 60fb ad03 a4e6 ee40  ..w.~..[`......@

(You can run the program by doing base64 -d (base64 file) > 1.sh && zsh 1.sh)

The resulting file is out.png (the bpgdec default location), which looks like this:

Because this uses bpgdec, this answer is obviously not eligible for the bounty.


EDITED: Added -n argument to tail to make it compatible with GNU tail.

The file is 1022 bytes long, which squeezes it in just under the 1024-byte limit. It consists of the line

exec bpgdec =(tail +2 $0)

(note that this means the script file contains all sorts of non-ASCII characters!)

Here's the full script, base64-encoded:

ZXhlYyBicGdkZWMgPSh0YWlsICsyICQwKQpCUEf7cACDAoJAAAOSQlADkkJQRAnBkJWBEgAAAAFEAcGQ
lYEWA3AAAAEmCa4LMOdgFmqXmtNBko/QcAAAAwAAAwAAAwAAAwAAAwAABMwAAAEmAa8FmP2ZkfnovyIg
ee9K0oPqUXvW7OF81Z1LPeoWgqO/o7j2XHUcVclZ0eLPE+EMGD8klWDAW2WXH458RT2y5PqAidz15AAQ
g0dNOrsHW6qV86xS7KFOKjRSFJO4lun7TV9GBQu/FPbsAEKRBdYmO/UkoyFhPK2JBtdJgynZ8dJ6zFVQ
ZdPzO9GV7t2lCZdQ+a68vPO1M4DI2wwb6TIaUi0Q93r5Z15ip2Z+5KB2qFvaz0F3MTYKc2K1dtLvxF3g
+abqStFafnsOMX8GhR2izwaAEU9Xu3R3Qhc0tq+uccACDrTqByU0jn3WAPetu/fVwvw+NoE4JCAXUc9a
y4pvsQ4m1fhd9s3DB7V23SWTFw/ptwfbrWM3RpY59weFgSoWuaE1Y8KSoRLXwS0llGGZxJkO+RcjRtxv
UaX9wDpEL0+wyRXpfYjThkeqtwXpfPLuxBngeJqjtXRkWmMaZ4q3x25pS9To37ZX1W6TUYdQY8IUHOO7
gwUzrTNiCOjUsMWor2eWlWOgrpam/QChAQXspdueJ87S+8jqdFcvOF/QCAoqx0kZa2pCTe8eAsQ2B94x
fA98sMkKYJu7wXrljRd/00BujfeB+PtRc2a+svtiUeNYzlXViiimO3sxDt69wp0TBKLAOd6TY41saMPT
52I27Urio754GxUKe4KfCwoUF7et4Wh6yE9aL4jRoUF2/r97wiBhiYQk1+M1lYgvHsmjYzUBMFb2+dzt
KzdzO4ZZ9emT+fpbQZrLeODv17Qeg3/OQ4N+7hCvK6oUResG11xCIFP5NP12wCEX+Rbzt/WZCXclYghd
otR0wS5sCiFcz2qfwEWR4N5mKa/eJ68r9nOMtbLqsHAx/bgfjbGOJTJDMaDKCOgB5LbfckApFrKnEn7k
wuasqvhM0X09RmXVgia9ZdpFPKyV2O0OEVN1hwns10VPULpMMUtKw7a3SWQe6OMhwCl64kYw/gXd0faO
VkaFfej7YB5FP+U+/g0MXl2mSgP22cWbC3+y3vNUIbvAxYu536Hz5Xanu84XXswnEl/dm63CzXnSwEPx
bfQgOtPEmyV/6hkFdiABv6R3jA6RRR0whtVZjX9ArXJgPskPWmLbCRFho227/AIKmDV/x6RoTDZRIAH8
cF5k1E5iPFJIpUL7Y2EkliH/MhsrezAWelYephj55S8xioDLI3zzyKRst0d5TujBd8J+s+9bYPutA6Tm
7kA=

(You can run the program by doing base64 -d (base64 file) > 1.sh && zsh 1.sh)

The resulting file is out.png (the bpgdec default location), which looks like this:

Because this uses bpgdec, this answer is obviously not eligible for the bounty.

The file is 1024 bytes long, right at the limit. It consists of the line

exec bpgdec =(tail -n+2 $0)

In hex, this is the script:

0000000: 6578 6563 2062 7067 6465 6320 3d28 7461  exec bpgdec =(ta
0000010: 696c 202d 6e2b 3220 2430 290a 4250 47fb  il -n+2 $0).BPG.
0000020: 7000 8302 8240 0003 9242 5003 9242 5044  [email protected]
0000030: 09c1 9095 8112 0000 0001 4401 c190 9581  ..........D.....
0000040: 1603 7000 0001 2609 ae0b 30e7 6016 6a97  ..p...&...0.`.j.
0000050: 9ad3 4192 8fd0 7000 0003 0000 0300 0003  ..A...p.........
0000060: 0000 0300 0003 0000 04cc 0000 0126 01af  .............&..
0000070: 0598 fd99 91f9 e8bf 2220 79ef 4ad2 83ea  ........" y.J...
0000080: 517b d6ec e17c d59d 4b3d ea16 82a3 bfa3  Q{...|..K=......
0000090: b8f6 5c75 1c55 c959 d1e2 cf13 e10c 183f  ..\u.U.Y.......?
00000a0: 2495 60c0 5b65 971f 8e7c 453d b2e4 fa80  $.`.[e...|E=....
00000b0: 89dc f5e4 0010 8347 4d3a bb07 5baa 95f3  .......GM:..[...
00000c0: ac52 eca1 4e2a 3452 1493 b896 e9fb 4d5f  .R..N*4R......M_
00000d0: 4605 0bbf 14f6 ec00 4291 05d6 263b f524  F.......B...&;.$
00000e0: a321 613c ad89 06d7 4983 29d9 f1d2 7acc  .!a<....I.)...z.
00000f0: 5550 65d3 f33b d195 eedd a509 9750 f9ae  UPe..;.......P..
0000100: bcbc f3b5 3380 c8db 0c1b e932 1a52 2d10  ....3......2.R-.
0000110: f77a f967 5e62 a766 7ee4 a076 a85b dacf  .z.g^b.f~..v.[..
0000120: 4177 3136 0a73 62b5 76d2 efc4 5de0 f9a6  Aw16.sb.v...]...
0000130: ea4a d15a 7e7b 0e31 7f06 851d a2cf 0680  .J.Z~{.1........
0000140: 114f 57bb 7477 4217 34b6 afae 71c0 020e  .OW.twB.4...q...
0000150: b4ea 0725 348e 7dd6 00f7 adbb f7d5 c2fc  ...%4.}.........
0000160: 3e36 8138 2420 1751 cf5a cb8a 6fb1 0e26  >6.8$ .Q.Z..o..&
0000170: d5f8 5df6 cdc3 07b5 76dd 2593 170f e9b7  ..].....v.%.....
0000180: 07db ad63 3746 9639 f707 8581 2a16 b9a1  ...c7F.9....*...
0000190: 3563 c292 a112 d7c1 2d25 9461 99c4 990e  5c......-%.a....
00001a0: f917 2346 dc6f 51a5 fdc0 3a44 2f4f b0c9  ..#F.oQ...:D/O..
00001b0: 15e9 7d88 d386 47aa b705 e97c f2ee c419  ..}...G....|....
00001c0: e078 9aa3 b574 645a 631a 678a b7c7 6e69  .x...tdZc.g...ni
00001d0: 4bd4 e8df b657 d56e 9351 8750 63c2 141c  K....W.n.Q.Pc...
00001e0: e3bb 8305 33ad 3362 08e8 d4b0 c5a8 af67  ....3.3b.......g
00001f0: 9695 63a0 ae96 a6fd 00a1 0105 eca5 db9e  ..c.............
0000200: 27ce d2fb c8ea 7457 2f38 5fd0 080a 2ac7  '.....tW/8_...*.
0000210: 4919 6b6a 424d ef1e 02c4 3607 de31 7c0f  I.kjBM....6..1|.
0000220: 7cb0 c90a 609b bbc1 7ae5 8d17 7fd3 406e  |...`...z.....@n
0000230: 8df7 81f8 fb51 7366 beb2 fb62 51e3 58ce  .....Qsf...bQ.X.
0000240: 55d5 8a28 a63b 7b31 0ede bdc2 9d13 04a2  U..(.;{1........
0000250: c039 de93 638d 6c68 c3d3 e762 36ed 4ae2  .9..c.lh...b6.J.
0000260: a3be 781b 150a 7b82 9f0b 0a14 17b7 ade1  ..x...{.........
0000270: 687a c84f 5a2f 88d1 a141 76fe bf7b c220  hz.OZ/...Av..{. 
0000280: 6189 8424 d7e3 3595 882f 1ec9 a363 3501  a..$..5../...c5.
0000290: 3056 f6f9 dced 2b37 733b 8659 f5e9 93f9  0V....+7s;.Y....
00002a0: fa5b 419a cb78 e0ef d7b4 1e83 7fce 4383  .[A..x........C.
00002b0: 7eee 10af 2baa 1445 eb06 d75c 4220 53f9  ~...+..E...\B S.
00002c0: 34fd 76c0 2117 f916 f3b7 f599 0977 2562  4.v.!........w%b
00002d0: 085d a2d4 74c1 2e6c 0a21 5ccf 6a9f c045  .]..t..l.!\.j..E
00002e0: 91e0 de66 29af de27 af2b f673 8cb5 b2ea  ...f)..'.+.s....
00002f0: b070 31fd b81f 8db1 8e25 3243 31a0 ca08  .p1......%2C1...
0000300: e801 e4b6 df72 4029 16b2 a712 7ee4 c2e6  .....r@)....~...
0000310: acaa f84c d17d 3d46 65d5 8226 bd65 da45  ...L.}=Fe..&.e.E
0000320: 3cac 95d8 ed0e 1153 7587 09ec d745 4f50  <......Su....EOP
0000330: ba4c 314b 4ac3 b6b7 4964 1ee8 e321 c029  .L1KJ...Id...!.)
0000340: 7ae2 4630 fe05 ddd1 f68e 5646 857d e8fb  z.F0......VF.}..
0000350: 601e 453f e53e fe0d 0c5e 5da6 4a03 f6d9  `.E?.>...^].J...
0000360: c59b 0b7f b2de f354 21bb c0c5 8bb9 dfa1  .......T!.......
0000370: f3e5 76a7 bbce 175e cc27 125f dd9b adc2  ..v....^.'._....
0000380: cd79 d2c0 43f1 6df4 203a d3c4 9b25 7fea  .y..C.m. :...%..
0000390: 1905 7620 01bf a477 8c0e 9145 1d30 86d5  ..v ...w...E.0..
00003a0: 598d 7f40 ad72 603e c90f 5a62 db09 1161  [email protected]`>..Zb...a
00003b0: a36d bbfc 020a 9835 7fc7 a468 4c36 5120  .m.....5...hL6Q 
00003c0: 01fc 705e 64d4 4e62 3c52 48a5 42fb 6361  ..p^d.Nb<RH.B.ca
00003d0: 2496 21ff 321b 2b7b 3016 7a56 1ea6 18f9  $.!.2.+{0.zV....
00003e0: e52f 318a 80cb 237c f3c8 a46c b747 794e  ./1...#|...l.GyN
00003f0: e8c1 77c2 7eb3 ef5b 60fb ad03 a4e6 ee40  ..w.~..[`......@

The resulting file is out.png (the bpgdec default location), which looks like this:

Because this uses bpgdec, this answer is obviously not eligible for the bounty.


EDITED: Added -n argument to tail to make it compatible with GNU tail.

added 137 characters in body
Source Link
nneonneo
  • 12.6k
  • 8
  • 31
  • 52
Loading
added 114 characters in body
Source Link
nneonneo
  • 12.6k
  • 8
  • 31
  • 52
Loading
Source Link
nneonneo
  • 12.6k
  • 8
  • 31
  • 52
Loading