Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6471091
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:11:06+00:00 2026-05-25T06:11:06+00:00

I am trying out a sample code that converts a color image to grey

  • 0

I am trying out a sample code that converts a color image to grey scale on a canvas in WebOS (enyo). When I use the ctx.getImageData method to read the pixels, the imageData contains only zeros. The sample I am using is provided in the link below:

http://chopapp.com/#x8t2ymad

Does WebOS support reading pixel data from canvas? Am I doing something wrong here?

I have refered to the following link for the logic and the code:

http://net.tutsplus.com/tutorials/javascript-ajax/how-to-transition-an-image-from-bw-to-color-with-canvas/

This works fine.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T06:11:07+00:00Added an answer on May 25, 2026 at 6:11 am

    you should move the getimagedata in the callback from the onload event of the image.

    something like:

    draw: function(image) {
        this.ctx.drawImage(event.target, 0, 0);
        this.greyImage();
    },
    

    and set the source after binding the event

    image.onload = enyo.bind(this, "draw");
    image.src = "images/image.png";
    

    to avoid a racing condition

    now the imagedata is retrieved before the actual pixels are loaded. Which results in an empty array.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was trying out a code sample from this book that should demonstrate that
I am trying to work out a code sample to demonstrate the debugging functionality
I'm trying to run the sample unit tests for the sample code that ships
I'm trying to figure out how to generate a simple join that uses an
I'm trying to figure out how to use the System.Net.WebRequest class to send my
I am trying to do something similar to this sample code from Phil Haack
I was trying out a simple JSF application, in which I need to check
Very confused here, trying out the yuicompressor on a simple javascript file. My js
I'm trying to figure out why a simple query in LINQ is returning odd
I am trying to get put out a simple site, which would pool the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.