[ prog / sol / mona ]

prog


Simple image file formats

1 2022-05-23 15:33

The simplest raster image file format is probably netpbm (PBM, PGM, PPM), which is essentially an ASCII text file containing RGB triplets. However, it takes up a lot of space even if the entire image consists of pixels of the same color, because an RGB triplet has to be explicitly listed for every single pixel.

The BMP format is more complex than netpbm, but it seems that BMP can achieve much smaller file sizes by using a "color table" in its header to reduce repetition. BMP also has the advantage of portability. All major web browsers are able to render BMP images.

Are there other simple raster image formats that are reasonably portable? (i.e. can be rendered by most image viewing software).

2 2022-05-24 19:07

We should make one based on S-expressions.

3 2022-05-25 06:25

>>2

#!/usr/bin/scemeh
(imrpot "imge-file-fromat.scm")
(canvas 1600 1200)
(image (
  (solid "black" (circle 200 300 15))
  (gradient ((0.0 #fef0fe) (1.0 #050000)) (rect 50 100 200 20))
  (cubic-bezier-path ((0.0 0.0) (1600.0 0.0) (0.0 1200.0)))
))
4 2022-05-25 11:38
(png/decode (base64/decode "iVBORw0KGgoAAAANSUhEUgAAAIAAAACgAQMAAAD+XPa+AAAABlBMVEX///8AAABVwtN+AAADtElE
QVQYGQXBv4smdwEH4Gc+79y+o9nk5roTgjteGskvtkuwMEOwULC40vL+A1NYKEj8njlIk2L/hMPS
KmWawFyTHFi4BNLIgZM1krcIZlz2yOw67zs+TyiqdQUQCAUgAACBmh4ggA4gKhpagFhBAxAVLQAC
ABDoABDgySOAAP0AEOgBEABQCFiNoBAKBCBQKgeAAMMFQIBuAgigBQhwB2xmAhRQI6goO3oaAqwd
vIBgdd2iOCBWzFBAAHhngACnWPsWQcVU8RAENHOj8kqLADvW8vhjBCugaxFQv3+bM9uRAA875rb5
MQG+wnLsQEDu9+CKgOr8fZtHnBHgIYffUwgU7y6ihwD1tgCCt4pf6hnWtwkae7p9UX1GMEJrAKHq
oHk2gpABbnUTKwGZycz/CMD6HAg1w+LyeKQmoNo/bn+38AoB/Hb+9D7TIDT0Zf7V9C2nnQD2z8aJ
oZWTMqM/vAf7n4oerD8z+2e3E6Dz2OKvyPT5DP7mTfNEpk/O0drZMpP1SY9jV55eloVU70yIGQXp
z2FfcNkjYwubfjn1aEC+6aDqgoL84ylo69EW0i6gcayFeBl8vQaIB+DeD6sB5N0CqtcA+fIG3Dzi
YUGab2rY9D5fC1JGsClruYTcH2pQXLeQ7+YFOIBNnn84g/8sQFrAFSBvAACiasC4A3J7OQCACMAx
W/JJBRDukletQEH3QL47qQB3WO9KdwEz8EWpAzQw+L5uwgroOo330lGAJ519ZKSAgu9JAcB2vBEU
gKbenQUFOlgeCwrA6y+WNgWAl36BFAZgM2kIAC9TmwLQ6g42BD3QL0URAAqOpGCFCv4gA6qCgDYF
KxOwdukZkGb/34IhgC3tQCWAo75VQwYceK4xQgbg1jgJBAyOJkAKUC0zkAI9hQv20gN6QB4A8z1O
SEkPHLEZISOQ42oBGaBQAVIAVgcIAFCVQIWjUgKBhT1AsJ6QDwwguEEVIwjgawMQuGZfDRMIRhjK
DAJwDgjgZH5w/aOCwD08Y3eGAK5exBUCuPXRGfuKAI7+MkArgMMFuBTU4F+w9gFspl8XeBKAaQAC
0E5AABo9CBY4moEAVH8EgrqGn3cguBrhBAhq0P4ZBC900JyDwA52X4EAGJ+D4N9gWECw7LCWBQRu
cAMIrB07QAA6QNAbHAog6KpJdoCwLTp+A4jtXDc4BeRPsx+UcdYAUrjoT79VA4JuM7wkgMDs7ypA
MKcfigEI7v5kXwYdEGivjFog0JybNEBAb3YEBK5ZVAX8H/GJQ8VP7YH7AAAAAElFTkSuQmCC"))
5 2022-05-26 06:37

>>4
PNG is not exactly a simple image format to write or parse.

6 2022-05-26 06:56

>>1
ASCII

           ..............
       ...';;;;'.............
     .....oWMMWXk;.............
   .......lKKNMMMXo'.............
  ...........,dNMMMd..............
 ..............kMMMNc..............
 .............lNMMMM0'.............
 ............oNMMMMMWo.............
 ...........cNMMNOWMMXl............
 ..........,KMMMx,OWMMNc...........
 .........,OMMMK,.,0MMM0,.........
  .......;KMMMXc...:NMMMXko,.....
    ....'xKKKO;.....:0WMMW0,....
     .................,::;,....
        ....................
            ............
7 2022-05-26 07:57

>>6
Oh....man...this is fuckin textacular!

8 2022-05-26 07:59

If you are reading this post all summer/sol/stice fags will infiltrate prog within seven days. To undo this curse you need to copy this and paste it in 20 other threads. I'm so, so sorry, please forgive me.

9 2022-05-26 10:27

i am a computer spirit. i am conjuerd w/ spells. if you dont repost this comment on 10 other pages i will find your car and transform it into a cdr.

10 2022-05-28 02:26

he was a shadow of a man he was a shadow of a man he was a shadow of a man he was a shadow of a man he was a shadow of a man he was a shadow of a man

11 2022-07-24 19:42

what about video file formats?
which would be the simplest, the unbloatted?

12 2022-07-26 15:09

>>11
store the individual frames in the appropriate Netpbm format, and the audio in some PCM format. then tarball and gzip the whole thing. you'd have to write a player for it.

example:
0000.ppm, 0001.ppm, 0002.ppm, track0.l16 => video.tar => video.tar.gz

13 2022-07-28 04:21

because an RGB triplet has to be explicitly listed for every single pixel

why not use simple text compression that deduplicates it instead of reinventing the wheel

14


VIP:

do not edit these