Re: two CLJS get-pixel bugs

9 views
Skip to first unread message

Nikita Beloglazov

unread,
Sep 4, 2017, 4:22:17 PM9/4/17
to Heow Goodman, clj-pro...@googlegroups.com
+clj-processing 

Hi Heow

load-image is asynchronous which means that image returned as result might not be loaded just yet. To check if image loaded you can check that width/height of the image is not 0. Once it loaded get-pixel should work fine.

Here is an example: http://quil.info/sketches/show/-KtDY8GpF51bGeTjSzfg hover over image and it'll show pixel value. 

Nikita

On Sun, Sep 3, 2017 at 4:07 PM Heow Goodman <he...@alphageeksinc.com> wrote:
Niktia,

Please verify these 2 CLJS get-pixel bugs.

In CLJS get-pixel always returns 0, sample code:

  (quil/get-pixel (quil/load-image "resources/background.png") 200 200)

In CLJ it at least returns numbers, and yes it's very slow.


Also, if I point it at a pre-loaded image to it such as like this:

(quil/get-pixel (:image (:background state)) 200 200))

I get the error:  "Uncaught Image is loaded remotely. Cannot get x,y."

This behavior does not throw an error in CLJ.


- h
Reply all
Reply to author
Forward
0 new messages