TinyPicURL is moving!

September 30, 2009

For the sake of completeness I thought I should post here that TinyPicURL is moving to its new home at http://tinypicurl.ianadie.co.uk so update your bookmarks ;)

Matching “Bad” Colours

January 26, 2009

One of the problems I faced in decoding TinyPics is matching potentially washed out colours with the 7 colours I’m using to make up TinyPics.  Now that I have the decoding functionality working here’s an explanation of how it’s being done.

As I’m only using 7 colours each TinyPic is easily represented by an indexed GIF image.  Normally, GIF images have an index of 256 colours, JPEGs up to 16million colours.  The index of TinyPic GIFs, however, only needs to have 7 colours.  So what I’ve done is forced my own 7 colour index onto whatever image is presented to my system.  That way, PHP does the colour matching for me, and I didn’t have to worry abo9ut matching up RGB values.

The way I have forced this seven colour index onto images was the trickiest part.  I imagined that PHP would have functions to allow me to build up my own index from any RGB values I wished.  That wasn’t the case unfortunately.  To get around this I’ve used the PHP function imagecopypalette() which lets you force another images index onto an image.  So I created up a seven colour gif (here it is here, look closely- ) and copied the palette of that image onto uploaded TinyPics.  Strangely, this palette copying function doesn’t seem to work on JPEG images, so for those to work I’ve had to convert from JPEG to GIF on the fly.

I’ve done a little testing by manually changing colours and it works on tyat level.  Next, I need some real testing using photographed Tinypics.

Last Month Roundup

January 21, 2009

It’s been a while since I’ve updated so it’s a monthly roundup today, to be followed by a more in depth post later.

What I’ve done this week month-

  • Got my “create TinyPic” feature working on the web app.  Go try it at https://devweb2008.cis.strath.ac.uk/~iadie/TinyPicURL/
  • Got close to getting the “retreive URL” feature on the web app working.  I’ve got as far as finishing the colour matching, which I think was the trickiest part.

What I’m going to do next week soon-

  • Fisnish off the “retreive URL” feature on the web app.
  • Write a specifications document for the mobile application.

Friday Roundup 12/12/2008

December 12, 2008

What I’ve done this week-

  • Spoke to staff and students about my project at the poster day.  OK, it’s not any “real” work but I’ve had too many other deadlines to make progress.

What I’m going to do next week-

  • After Wednesday I have no more deadlines so I can get some more work done on the web application.  Hopefully I’ll be able to create TinyPics by next Friday.

Friday Roundup 05/12/2008

December 6, 2008

What I’ve done this week-

What I’m going to do next week-

  • Continue developing the webstite.
  • Explain my project to a few people at a poster day.

Friday Roundup 28/11/2008

November 29, 2008

What I’ve done this week-

  • Written a software specification for my web application.

What I’m going to do next week-

  • Start some web design!

Friday Roundup 14/11/2008

November 14, 2008

What I’ve done this week-

  • Decided how I will map grids of colour to six characters.  The previous blog post explains this.
  • Joined SnipURL.com.  As tinyURL.com hadn’t got back to me about the API I’ve joined another website which provides an API as standard to investigate it’s possible use in my project.

What I’m going to do next week-

  • Write a specification for my project.  This should include some use cases.

Colours -> Characters

November 14, 2008

I’ve been thinking of a few ways to go from my representation of a URL (grid of colour) to the representation I need (characters).  I was trying to think of a “clever” way of doing this, such as representing a grid by a matrix of RGB values and doing some calculations from there.  But I don’t think there’s any need to make it that complicated.

As you may have read in my previous post, I think I’ll need to make the grid 3×4 (or vice versa) in order to store enough information.  That gives me 12 colour squares, or six pairs.  So the simplest way to do this is to use colour pairings to represent characters i.e. a red square paired with a green square represents ‘a’, a blue square followed by a magenta square represents ‘b’.  It may not be all that clever, but using the six colours shown in previous posts gives me 36 combinations which is exactly what I need.

I need to have a representation for ‘null’ however, as tinyurl.com/6 does not equal tinyurl.com/000006. I can round this by introducing white and use pairings with white to represent nothing.

Grid Size Thoughts

November 5, 2008

Originally I wanted to use a grid with a size of 3×3.  I thought that nine colours, three bytes per character, would be enough to encode a string of six alphanumeric (a-z and 0-9) characters, going by the tinyURL.com method.  After some investigation on colours however I don’t think it will be possible.

In my previous post you can see the investigation I’ve done into colours and how they are represented when printed and photographed.  What this research has shown is that I will have to use RGB values of either 0 or 255.  If I try to use numbers in between then I could not guarantee that my system will be able to tell them apart.  Essentially this means that my RGB values are now in binary, a colour’s red, green or blue value will have to be either ‘on’ or ‘off’.  Each colour can be represented by a three bit string (blue would be 001 for example as it has no red, no green, but does have blue).

This means that a grid of nine colours gives me a 27 bit string.  This gives 134,217,728 (2^27) combinations.  If I’m to use tinyURL.com’s API, and in turn use six alphanumeric characters then I need 2,176,782,336 (36^6) combinations.  Unless I have a ‘eureka’ moment I’m looking at adding another row of colours.

Colour investigation- N95

November 5, 2008

I’ve been doing some research on how well colours are represented when printed and photographed.  As my final solution will hopefully include a mobile application which will be able to decode TinyPics this research will tell me how many colours I can realistically use.  I need the margin of error to be as big as possible to stop the colours being mistaken for each other.

The figures below have been taken from images taken by the camera on a Nokia N95, a five megapixel camera which I’d consider to be one of the higher quality cameras found on mobile phones today.  The colours researched and their respective RGB values are below.

R G B
Red 255 0 0
Green 0 255 0
Blue 0 0 255
Cyan 0 255 255
Magenta 255 0 255
Yellow 255 255 0
White 255 255 255

Once printed and photographed, the RGB values of the colours are shown below.

In good light with no flash-

n95-good-light

And in bad light with a flash as shown below-

n95-bad-light

As you can see from the graph above, colours photographed in bad light don’t keep their RGB values very well, and the above values are with the “good” camera.  This means I will have to use colours at the extremes of the RGB scales and nothing in between i.e. Magenta is supposed to have red and blue values of 255, but once photographed these colours drop to less than 100, if I tried to use red and blue values of, say, 127 then they would drop so much it would become on a par with the green value (which has grown from 0 to 45).


Follow

Get every new post delivered to your Inbox.