Page 1 of 1

my first two pieces

Posted: Fri Apr 14, 2006 10:37 am
by logic
Here are my first two pieces:

Information Overload

Based on chris' "Self-dividing grid", this was what helped me understand that the fundamental paradigm of Context Free is to make things smaller as you recurse :-) Otherwise, the drawing never ends.

Image

(download)

Code: Select all

startshape MATRIX
background { sat 1 b -1 alpha 1 }

rule MATRIX
{
  MATRIX { s 0.5 1 x -0.25 }
  MATRIX { s 0.5 1 x +0.25 }
}

rule MATRIX
{
  MATRIX { s 1 0.5 y -0.25 }
  MATRIX { s 1 0.5 y +0.25 }
}

rule MATRIX .3
{
  GREENGLYPH {}
}

rule GREENGLYPH { GLYPH { hue 120 sat 1 b 0.3 } }
rule GREENGLYPH { GLYPH { hue 120 sat 1 b 0.4 } }
rule GREENGLYPH { GLYPH { hue 120 sat 1 b 0.5 } }
rule GREENGLYPH { GLYPH { hue 120 sat 1 b 0.6 } }
rule GREENGLYPH { GLYPH { hue 120 sat 1 b 0.7 } }

include i_pix.cfdg

rule GLYPH { A_5by5 {} }
rule GLYPH { B_5by5 {} }
rule GLYPH { C_5by5 {} }
rule GLYPH { D_5by5 {} }
rule GLYPH { E_5by5 {} }
rule GLYPH { F_5by5 {} }
rule GLYPH { G_5by5 {} }
rule GLYPH { H_5by5 {} }
rule GLYPH { I_5by5 {} }
rule GLYPH { J_5by5 {} }
rule GLYPH { K_5by5 {} }
rule GLYPH { L_5by5 {} }
rule GLYPH { M_5by5 {} }
rule GLYPH { N_5by5 {} }
rule GLYPH { O_5by5 {} }
rule GLYPH { P_5by5 {} }
rule GLYPH { Q_5by5 {} }
rule GLYPH { R_5by5 {} }
rule GLYPH { S_5by5 {} }
rule GLYPH { T_5by5 {} }
rule GLYPH { U_5by5 {} }
rule GLYPH { V_5by5 {} }
rule GLYPH { W_5by5 {} }
rule GLYPH { X_5by5 {} }
rule GLYPH { Y_5by5 {} }
rule GLYPH { Z_5by5 {} }
Gray Matter

I wanted to make something that looked like neurons, and found that if I didn't vary the brightness, the result looked like a big black blob. This one requires the version 2.0 looping feature.

Image

(download)

Code: Select all

startshape NEURON;

rule NEURON
{
  CIRCLE { s 3 }

  MED_CURVE_LEFT { r 90 }
  MED_CURVE_RIGHT [ r 101 y 9.94981 r 9 ]
  NEURON [ r 101 y 9.94981 r -2 y 9.94981 r 109 s 0.85 b 0.05 ]

  HARD_CURVE_LEFT { r 180 }
  HARD_CURVE_RIGHT [ r 211.5 y 9.55039 r 28.5 ]
  NEURON [ r 211.5 y 9.55039 r -3 y 9.55039 r 128.5 s 0.85 b 0.05 ]
}

rule NEURON
{
  CIRCLE { s 3 }

  HARD_CURVE_RIGHT { }
  MED_CURVE_LEFT [ r -31.5 y 9.55039 r -28.5 ]
  SOFT_CURVE_RIGHT [ r -31.5 y 9.55039 r -17.5 y 9.94981 r 9 ]
  NEURON [ r -31.5 y 9.55039 r -17.5 y 9.94981 r 3.5 y 9.98744 r -154.5 s 0.85 b 0.05 ]

  SOFT_CURVE_LEFT [ r -132 ]
  SOFT_CURVE_LEFT [ r -126.5 y 9.98744 r 4.5 ]
  SOFT_CURVE_RIGHT [ r -126.5 y 9.98744 r 10 y 9.98744 r 4.5 ]
  NEURON [ r -126.5 y 9.98744 r 10 y 9.98744 r -1 y 9.98744 r -154.5 s 0.85 b 0.05 ]

  HARD_CURVE_LEFT [ r 100 ]
  HARD_CURVE_LEFT [ r 131.5 y 9.55039 r 28.5 ]
  MED_CURVE_RIGHT [ r 131.5 y 9.55039 r 60 y 9.55039 r 28.5 ]
  HARD_CURVE_RIGHT [ r 131.5 y 9.55039 r 60 y 9.55039 r 17.5 y 9.94981 r -9 ]
  NEURON [ r 131.5 y 9.55039 r 60 y 9.55039 r 17.5 y 9.94981 r -40.5 y 9.55039 r -158.5 s 0.85 b 0.05 ]
}

rule NEURON
{
  CIRCLE { s 3 }

  MED_CURVE_LEFT [ r 75 ]
  HARD_CURVE_RIGHT [ r 86 y 9.94981 r 9 ]
  NEURON [ r 86 y 9.94981 r -22.5 y 9.55039 r -158.5 s 0.85 b 0.05 ]

  MED_CURVE_RIGHT [ r 160 ]
  HARD_CURVE_LEFT [ r 149 y 9.94981 r -9 ]
  HARD_CURVE_RIGHT [ r 149 y 9.94981 r 22.5 y 9.55039 r 28.5 ]
  NEURON [ r 149 y 9.94981 r 22.5 y 9.55039 r -3 y 9.55039 r -158.5 s 0.85 b 0.05 ]

  HARD_CURVE_LEFT [ r -160 ]
  HARD_CURVE_RIGHT [ r -128.5 y 9.55039 r 28.5 ]
  NEURON [ r -128.5 y 9.55039 r -3 y 9.55039 r -158.5 s 0.85 b 0.05 ]
}

rule NEURON 2 { CIRCLE { s 3 } CIRCLE { s 2 b 1 } }

rule SOFT_CURVE_LEFT
{
  // after last block, offset is:
  //  r 5.5 y 9.98744 r 4.5
  10*[r 1 y 1] SQUARE { }
}

rule MED_CURVE_LEFT
{
  // after last block, offset is:
  //  r 11 y 9.94981 r 9
  10*[r 2 y 1] SQUARE { }
}

rule HARD_CURVE_LEFT
{
  // after last block, offset is:
  //  r 31.5 y 9.55039 r 28.5
  20*[r 3 y 0.5] SQUARE { }
}

rule SOFT_CURVE_RIGHT
{
  // after last block, offset is:
  //  r -5.5 y 9.98744 r -4.5
  10*[r -1 y 1] SQUARE { }
}

rule MED_CURVE_RIGHT
{
  // after last block, offset is:
  //  r -11 y 9.94981 r -9
  10*[r -2 y 1] SQUARE { }
}

rule HARD_CURVE_RIGHT
{
  // after last block, offset is:
  //  r -31.5 y 9.55039 r -28.5
  20*[r -3 y 0.5] SQUARE { }
}
I want to upload these to the gallery, but whenever I try, I get this:
Upload your artwork!

ERROR: exec() error: ERROR: exec() error: ERROR: exec() error: Sorry, couldn't insert design into DB.\n

ERROR: exec() error

Posted: Sat Apr 15, 2006 7:43 am
by Ylee
I got the same error today when uploading. In my case it seemed to be because I Was running Context Free with the same file open I was trying to upload. When i closed the file in CF i was able to load the code with no problem. :roll:

Re: ERROR: exec() error

Posted: Sat Apr 15, 2006 7:55 am
by logic
I still get the error when I'm absolutely sure nothing has the file open. :-(

Posted: Sat Apr 15, 2006 9:08 am
by MtnViewJohn
Maybe Chris could open-source the PHP code for the gallery and we could figure this out. At some point in the not too distant future I will integrate the gallery into the new Context Free site under the common login. You will be able to submit your designs directly from the CF client.

Gallery fixed, hopefully

Posted: Sun Apr 16, 2006 11:24 pm
by chris
Can you try again? Cool designs by the way.

There were 2 different problems with the upload page. One was all those exec errors which are just the results of a failed attempt to reduce color depth. (I had a permissions error after migrating directories.) The other was that if you put any apostraphes in a post it (duh) broke a line of code. I forgot to escape your notes. (It actually was a security mistake.)

-cc

Re: Gallery fixed, hopefully

Posted: Mon Apr 17, 2006 9:37 am
by logic
chris wrote:Can you try again? Cool designs by the way.
Thanks :-)

Here is the output when I add items to the gallery:
Upload your artwork!
ERROR: exec() error: ERROR: exec() error: ERROR: exec() error:
Image Success!
You successfully uploaded Information Overload and we've rescaled the image to 3 different sizes.
Image
They are actually added, though :-)
chris wrote:There were 2 different problems with the upload page. One was all those exec errors which are just the results of a failed attempt to reduce color depth. (I had a permissions error after migrating directories.)
The forum here seems to have a similar problem with permissions with respect to avatars: uploads fail silently. I had to host my avatar on my own site to get it to work (and I had to manually build the URL to the phpbb-specific profile editor, since I couldn't find a link to it anywhere and the profile editor I could find a link to didn't offer the "link to an off-site avatar" option :-)).

By the way, why are you reducing the colour depth? It's already a palettized file, isn't it? Are the savings in size that great?

chris wrote:The other was that if you put any apostraphes in a post it (duh) broke a line of code. I forgot to escape your notes. (It actually was a security mistake.)
An alarmingly common error. :? Whenever I write database code, I make every effort to use structured parameters for everything -- is this an option with the framework you're using? (I've never used PHP myself, so...)

Posted: Mon Apr 17, 2006 9:49 am
by chris
I'm not sure about avatars here. John and Mark host the forum now, but it could be from copying my old images directory over (I just sent it to them a few days ago...maybe it's fixed now?)

The color depth was a quick hack because the images were huge -- often a few hundred K. I added the reductoin step back when they were all just black and white anyway. As soon as I get to it I'll spend some time figuring out the best way to compress them.

Posted: Tue Apr 18, 2006 11:34 am
by logic
chris wrote:The color depth was a quick hack because the images were huge -- often a few hundred K. I added the reductoin step back when they were all just black and white anyway. As soon as I get to it I'll spend some time figuring out the best way to compress them.
Well, a JPEG file will give the smallest file size, but it will also completely mangle high-saturation detail, especially reds and blues.

See:

http://israel.logiclrd.cx/jpeg/

(run your mouse along the bar at the top once it has finished loading to see various JPEG quality levels)

Note that even at maximum quality (1% compression), while black & white detail is fine, the 100% saturation coloured data is fuzzy and, in places, verging on unreadable.

Perhaps some sort of heuristic could be used, where JPEG is employed only if the user provided a JPEG file initially OR the maximum saturation of any pixel (or the 3rd greatest saturation or what have you) is below a certain threshold.

Posted: Tue Apr 18, 2006 5:49 pm
by MtnViewJohn
I copied over the avatars from the original phpbb site and fixed the permissions on the avatar directory. Please try to upload your avatar again.