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

  • SEARCH
  • Home
  • 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 792987
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T22:04:47+00:00 2026-05-14T22:04:47+00:00

Given a PNG in a web context with some transparent pixels and some non-transparent

  • 0

Given a PNG in a web context with some transparent pixels and some non-transparent pixels, is there a way in Javascript to determine if a user has clicked on a non-transparent pixel? A webkit-only solution would be perfectly acceptable.

  • 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-14T22:04:47+00:00Added an answer on May 14, 2026 at 10:04 pm

    1) Create HTML5 canvas of same size as your image
    2) Get Canvas’s context, drawImage(yourImage, 0, 0)
    3) d = context.getImageData(0, 0, w of img, h of img)
    4) d.data[(y*width+x)*4+3] for the alpha

    canvas = document.createElement("canvas");  //Create HTML5 canvas: supported in latest firefox/chrome/safari/konquerer.  Support in IE9
    canvas.width = img.width;                   //Set width of your rendertarget
    canvas.height = img.height;                 // \  height \   \     \
    ctx = canvas.getContext("2d");              //Get the 2d context [the thing you draw on]
    ctx.drawImage(img, 0, 0);                   //Draw the picture on it.
    id = ctx.getImageData(0,0, img.width, img.height);  //Get the pixelData of image
    //id.data[(y*width+x)*4+3] for the alpha value of pixel at x,y, 0->255
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given a ByteArray containing JPG or PNG data, is there a way to retrieve
The web designer has given me HTML which looks like: <div .... style=background: transparent
Question: Given an image in PNG format, what is the simplest way to programmatically
I have an asp.net mvc3 project, it has some reports in aspx web pages.
alt text http://img216.imageshack.us/img216/2288/problem11.png As given in the picture, I have an search bar in
Given that the web application doesn't have su privileges, I'd like to execute a
I'm working on a web development project usng PNG transparency, CSS3 and all the
I have a Base64 encoded PNG squeezed out of a web socket into a
I'm using JavaScript to create and remove elements from a web page. I've got
I have web page that has a collection of tiled elements as a background.

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.