User:Eleanorg/1.2/Forbidden Pixels/extracting pixel colours: Difference between revisions

From XPUB & Lens-Based wiki
(Created page with "Aim: to break an image down into a list of each pixel's position & colour, so that it can be re-created with html & css. Each pixel becomes an area coloured with a #hex code; thu...")
 
Line 4: Line 4:
===ImageMagick colour extraction===
===ImageMagick colour extraction===
Command syntax: convert imagename.png -format '%[pixel:p{xpos,ypos}]' info:-
Command syntax: convert imagename.png -format '%[pixel:p{xpos,ypos}]' info:-
Returns the rgba value of the bottom right pixel in a 20x10 grid:
<source lang="bash">
<source lang="bash">
# convert 20by10PixelsSection1.png -format '%[pixel:p{20,10}]' info:-
# convert 20by10PixelsSection1.png -format '%[pixel:p{20,10}]' info:-
rgba(135,161,160,1)
rgba(135,161,160,1)
</source>
</source>

Revision as of 15:14, 19 January 2012

Aim: to break an image down into a list of each pixel's position & colour, so that it can be re-created with html & css. Each pixel becomes an area coloured with a #hex code; thus manipulable - and no longer strictly part of an image. Question: how to write a script that will extract a grid of pixel colours from a given image?

ImageMagick colour extraction

Command syntax: convert imagename.png -format '%[pixel:p{xpos,ypos}]' info:- Returns the rgba value of the bottom right pixel in a 20x10 grid:

# convert 20by10PixelsSection1.png -format '%[pixel:p{20,10}]' info:-
rgba(135,161,160,1)