Pixler: a transparent PNG pixel generator

I made a weensy little script for the theme I recently made (which I still have not named or prepared for distribution) which will generate single pixel transparent pngs to use as tiled background images in css.

demonstration toy

<?php    
 
	$p = imagecreatetruecolor(1, 1);
	imagesavealpha($p, true);
	$o = (100 - (int) $_GET['o']) * 1.27;
	$c = imagecolorallocatealpha($p, (int) $_GET['r'], (int) $_GET['g'], (int) $_GET['b'], $o);
	imagefill($p, 0, 0, $c);
	header("Content-type: image/png");
	imagepng($p);
 
?>

usage / parameters:

r
how much red to include: r=[0-255]
g
how much green to include: g=[0-255]
b
how much blue to include: b=[0-255]
o
how opaque the pixel should be: o=[0(fully transparent)-100(fully opaque)]

so…

pixler.php?r=255&g=255&b=255&o=50
will make a white pixel that is 50% visible.
pixler.php?r=255&o=100
will make a red pixel that is fully visible.
pixler.php
calling the script with no parameters will create an invisible black pixel (…).

trackback

Tags: , , , , 10 responses »
  1. Jorge's gravatar

    awesome script! i’ve been looking for exactly this script!!!!! kudos!

  2. atom's gravatar

    @Jorge

    this is one i made more recently, which is a tad better, and does gradients too:

    http://github.com/re5et/trickyInc/blob/master/images/trickyImg.php

  3. DouG Molidor's gravatar

    Pretty frikkin cool. Works like a charm.
    Do you have examples for JPG and GIF too?

    Thanks.

  4. atom's gravatar

    @DouG Molidor

    i suspect that you are slightly confused. Neither JPG or GIF support alpha channel transparency.

  5. Jorge's gravatar

    @atom i’ll try that out, thanks!

  6. The Sheraz's gravatar

    Nice snippit! We are using it on our splash page for a new project coming up. Cheers!

  7. 女性人体艺术's gravatar

    博客写的很好,有很多值得学习的地方,给博主留个言,记得回访哦。

  8. 人体艺术图片's gravatar

    博主写的真的很好,在这里给你留个言了,我的网站比较前卫,博主不要介意啊,以后多多关照。

  9. Guy's gravatar

    Great code, thanks!

  10. 青岛卓众信息科技有限公司's gravatar

    青岛卓众(www.chinajoyzone.com)给博主拜年来了,新的一年,祝博主前途似锦。

Leave a Reply

ok to use:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

bonus!

If you want to post code, you can use:

<pre lang="[language]">[code]</pre>

Where [language] is a valid geshi language type, and where [code] is your code.

Wordpress 2.5, a half-assed review.

wordpress 2.5 admin

Good:

  • The design has been updated and is much less offensive to the eyes.
  • The dashboard has better information at first glance.
  • Dashboard widgets will probably be pretty cool.
  • The new flash uploader is a big improvement.
  • The new gallery feature seems pretty cute, although it isn’t the sort of thing I usually go in for.
  • Full screen post writing is nice if you have a lot to write.
  • Tag management / tag filling is handy.
  • The ability to define permalinks on the fly when writing a post is neat.

Bad:

  • The admin has a max-width that is very noticeable (annoying) on a widescreen monitor, especially because it is not centered.
  • I miss the categories being on the sidebar on the post pages.
  • Tags still are not searchable. Why are tags not searchable?
  • There is even more Javascript in the admin than before, for an impressive total of 324Kb, ~2 second load.

TBD:

  • Whether or not any of the cute little enhancements break the hell out of plugins that I don’t feel like updating.
  • Whether or not nightmarish new vulnerabilities have been introduced. With an update this big, it is almost a sure thing.

Watch Matt’s screencast for a quick overview, I have to update the rest of my sites.

trackback

Tags: , , , 4 responses »
  1. nocash's gravatar

    They have a list of compatible plugins. I only glanced through, but the only one that jumped out at me was Twitter Tools, which loses the ability to post from the sidebar. With twhirl, though, I doubt it matters.

    I bet it breaks the hell out of Hello Ninja, though :(

  2. cliff's gravatar

    How about that one-click plugin updating? I thought that was pretty sweet.

  3. atom's gravatar

    @cliff

    yeah, it will be cool when all plugins comply to it, and they change it so you don’t have to de/reactivate any plugin that is updated.

  4. Jacob Kennedy's gravatar

    I’m with you on the categories point. It was very handy on the sidebar.

    I love the media handling now. Major improvement.

    Why doesn’t the basic editor have some basic HTML formatting though. A quick dropdown for formatting a line as an h1 or an h2 would be usable for every level of user.

Leave a Reply

ok to use:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

bonus!

If you want to post code, you can use:

<pre lang="[language]">[code]</pre>

Where [language] is a valid geshi language type, and where [code] is your code.