Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

ANN: Rebol/Flash dialect updated and JPG-analyse

 [1/3] from: oliva:david:seznam:cz at: 4-Jan-2002 20:08


ANN: Rebol/Flash dialect updated and JPG-analyse ================================================ Hello... I've updated a little bit my Rebol/Flash dialect again so now I'm able to include bitmaps (as textures or images)... You can find updated dialect files and some new examples at: http://www.sweb.cz/oliva.david/swf/ Playing with JPGs I've found that some programs (usually from Adobe) includes some informations in the JPG files that are not so necessary... so I've created small script that I call %jpg-analyse.r and uploaded this script to the library. Using this script it is possible to make some of the JPGs smaller... For example: http://www.rebol.com/view/demos/palms.jpg from 26418 B to 18438 B or http://www.rebolforces.com/reb/images/smudge.jpg from 6150 B to 2898 B Now I have more then 11MB free space on my disk thanks to removing these data from JPG files:-)) Unfortunatelly I still don't know how to find size (without need to use Rebol/View) of the jpg image, because I don't have good JPG spec. so if someone know how to do it, please let me know... Happy New Year... Oldes +++++++++++++++++++++++ QUID SIT FUTURUM CRAS, FUGE QUAERERE! pridie Nonas Ianuaris MMII

 [2/3] from: pwoodward:cncdsl at: 4-Jan-2002 15:09


Oldes - here's a link to a document describing the JFIF (what most "JPEG" files are) format - http://www.w3.org/Graphics/JPEG/jfif.txt Typically they define an APPO marker to contain the "resolution" of the image. However, since the format was derived from a photographic background, it won't be in simple pixels. In theory you should be able to parse out the following bytes from a JFIF (jpg) file: X'FF', SOI X'FF', APP0, length, identifier, version, units, Xdensity, Ydensity, Xthumbnail, Ythumbnail, (RGB)n length (2 bytes) Total APP0 field byte count, including the byte count value (2 bytes), but excluding the APP0 marker itself identifier (5 bytes) = X'4A', X'46', X'49', X'46', X'00' This zero terminated string ("JFIF") uniquely identifies this APP0 marker. This string shall have zero parity (bit 7=0). version (2 bytes) = X'0102' The most significant byte is used for major revisions, the least significant byte for minor revisions. Version 1.02 is the current released revision. units (1 byte) Units for the X and Y densities. units = 0: no units, X and Y specify the pixel aspect ratio units = 1: X and Y are dots per inch units = 2: X and Y are dots per cm Xdensity (2 bytes) Horizontal pixel density Ydensity (2 bytes) Vertical pixel density Xthumbnail (1 byte) Thumbnail horizontal pixel count Ythumbnail (1 byte) Thumbnail vertical pixel count (RGB)n (3n bytes) Packed (24-bit) RGB values for the thumbnail pixels, n = Xthumbnail * Ythumbnail You'll note the X/Y values are stored as a "density" of units - so you may not be able to quickly determine an image is "320x200" or something similar... Most screen based pictures will be using a value of 72 dots per inch. - Porter ----- Original Message ----- From: <[oliva--david--seznam--cz]> To: <[rebol-list--rebol--com]> Sent: Friday, January 04, 2002 2:08 PM Subject: [REBOL] ANN: Rebol/Flash dialect updated and JPG-analyse
> ANN: Rebol/Flash dialect updated and JPG-analyse > > Hello... > I've updated a little bit my Rebol/Flash dialect again so now I'm able to
include bitmaps (as textures or images)...
> You can find updated dialect files and some new examples at: > http://www.sweb.cz/oliva.david/swf/ > > Playing with JPGs I've found that some programs (usually from Adobe)
includes some informations in the JPG files that are not so necessary... so I've created small script that I call %jpg-analyse.r and uploaded this script to the library. Using this script it is possible to make some of the JPGs smaller...
> For example: > > http://www.rebol.com/view/demos/palms.jpg from 26418 B to 18438 B > or > http://www.rebolforces.com/reb/images/smudge.jpg from 6150 B to 2898 B > > Now I have more then 11MB free space on my disk thanks to removing these
data from JPG files:-))
> Unfortunatelly I still don't know how to find size (without need to use
Rebol/View) of the jpg image, because I don't have good JPG spec. so if someone know how to do it, please let me know...

 [3/3] from: jasonic:cunliffe:verizon at: 4-Jan-2002 15:33


> I've updated a little bit my Rebol/Flash dialect again so now I'm able to
include bitmaps (as textures or images)...
> You can find updated dialect files and some new examples at: > http://www.sweb.cz/oliva.david/swf/
thankyou :-)
> Playing with JPGs I've found that some programs (usually from Adobe)
includes some informations in the JPG files that are not so necessary... so I've created small script that I call %jpg-analyse.r and uploaded this script to the library. Using this script it is possible to make some of the JPGs smaller... Interesting.. adctually I have been wondering about doing the opposite: I need to *add* some non-visual data into JPG's [such as little REBOL scripts] which can reliably survive normal passage through 3rd party graphics software. Anyone know how to do that for JPG/JFIF ? ./Jason