View unanswered posts | View active topics It is currently Sun Sep 05, 2010 2:28 am



Post new topic Reply to topic  [ 3 posts ] 
image processing 
Author Message

Joined: Sun Jul 25, 2010 9:27 am
Posts: 2
Post image processing
Hi,

I want to manipulate individual pixels of image - is it possible in newLISP ?
That is, I want to get RGB values of each pixel and change these values by my needs.
[If such functionality isn't there - maybe newLISP can be extended to support that ? If so - when ? :) ]

Thanks for answer.


Sun Jul 25, 2010 9:33 am
Profile E-mail

Joined: Sun Jul 25, 2010 9:27 am
Posts: 2
Post Re: image processing
As for now -I found workarround - read,modify & save PPM image file. It's trivial to work with PPM images, because format is very simple, kinda-
Code:
P3
# The P3 means colors are in ASCII, then 3 x 2 image size, then 255 for max color, then RGB triplets
3 2
255
255   0   0     0 255   0     0   0 255
255 255   0   255 255 255     0   0   0

Happy image processing !


Sun Jul 25, 2010 1:09 pm
Profile E-mail

Joined: Tue Nov 29, 2005 8:28 pm
Posts: 1691
Location: latiitude 50N longitude 3W
Post Re: image processing
I don't think you can do it newLISP-GS.

You can (sort of) do it with HTML5 canvas, although this involves so much intermediate JavaScript as to be depressingly slow. The relevant bits of the code I hacked together are:

Code:
(write-buffer page [text]
<script type="text/javascript" language="javascript" charset="utf-8">
    var a_canvas = document.getElementById("a");
    var a_context = a_canvas.getContext("2d");
    var input = a_context.getImageData(0, 0, a_canvas.width, a_canvas.height);
    var output = a_context.createImageData(a_canvas.width, a_canvas.height);
    var w = input.width, h = input.height;
    var inputData = input.data;
    var oD = output.data;
[/text])

; set pixel c to colour (where colour is RGB list eg  (0 0 0)):
(write-buffer page
   (string
        "oD[" c "] = "         (first colour) ";\n"
        "oD[" (+ c 1) "] = " (colour 1) ";\n"
        "oD[" (+ c 2) "] = " (colour 2) ";\n"
        "oD[" (+ c 3) "] = " 200 ";\n")

; and to output the array
(write-buffer page {
   a_context.putImageData(output, 0, 0);
  })


Have you seen onographic - here's my Mandelbrot attempt http://www.dmemos.de/onographic/contributions.htm with a version of didi's code. (I used a PPM to PNG converter, since PPM files aren't that useful...)


Sun Jul 25, 2010 5:03 pm
Profile WWW
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Forum style by Vjacheslav Trushkin for Free Forums/DivisionCore.