views:

48

answers:

1

I have found an image format that is being used by some applets. but i don't know what it is. I think it is some kind of vector graphics format that is used by the GD library.

could someone help me decode it?

I would like to use the raw data to produce a png, in php

the data is being generated from squiggles drawn by the mouse.

Is there some neato GD library function that I can feed the data into to recreate the image? (looking for a PHP libray function to do the job.) an example of the output from the form is below

array ('signature' => '209 142 209 142 209 142 209 142 209 141 209 143 208 143 208 141 208 
141 208 143 206 143 206 141 206 141 206 143 204 143 204 141 204 141 204 143 202 143 202 141 
202 141 202 143 200 143 200 141 200 141 200 143 197 143 197 141 197 141 197 143 195 143 195 
141 195 141 195 143 194 143 194 141 194 141 194 143 193 143 193 141 192 142 194 142 194 143 
192 143 193 142 193 144 192 144 192 142 191 143 193 143 193 144 191 144 191 144 193 144 193 
145 191 145 191 145 193 145 193 146 191 146 191 146 193 146 193 147 191 147 191 147 193 147 
193 148 191 148 191 148 193 148 193 149 191 149 191 150 193 148 196 151 194 153 195 153 195
151 196 151 196 153 196 153 196 151 197 151 197 153 197 153 197 151 198 151 198 153 198 153 
198 151 199 151 199 153 199 153 199 151 200 151 200 153 200 153....');

//snip// (numbers continue, followed by some colour settings,and a canvas size)
+3  A: 

Those look like X-Y coordinates. Just do a MoveTo on the first pair, then LineTo on the subsequent pairs.

Ignacio Vazquez-Abrams
i tried deleting a few of the numbers just to see what happened.. and it is not x,y pairs. (the lines became dotted after the remove al of a couple of numbers). I might try decoding teh applet to see what it is doing. plus teh amount of data generated seem s to be tehsame regardless of teh number of lines drawn
Bingy
That's why you use LineTo and not PlotXY for the pairs.
Ignacio Vazquez-Abrams
oops.. that last part is incorect. the ammount of data generated is dependant on the amount of drawing you do. So you may be right
Bingy
err.. so is there any neato PHP library that will plot xy points in a brushstroke?
Bingy
imageline() looks like your best bet. Just store the previous pair on the way through and draw the next line from there.
Ignacio Vazquez-Abrams
excellent.. will give it a go. I dod some further research, and it apears as if teh x,y corsinates are x1 y1 x2 y2 x1 y1 x2 y2. So every 4 numbers are a line.
Bingy
Even simpler. But a bit wasteful if these are meant to be strokes. Oh well.
Ignacio Vazquez-Abrams