Jump to content
  • Advertisement
Sign in to follow this  
ianp622

Image programming

This topic is 4509 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi everyone, this may be a stupid question, but here goes: Is it possible to gather/change data from an image in Java? Where would I begin to look into this? I'd like to create a function that could do 2d per-pixel transparency collision. So if I have a .gif of a circle with the outside being transparent, could I make a function that would collide only with the circle, rather than using coordinates. I'm sorry if my question isn't clear. Thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement
I never tried anything similar, but I think I may have an idea.

You see, every file format, including JPG, GIF, BMP, etc., has a specific file format. If you know the file format, you can select the parts, the specific bytes, that you're interested in and manipulate it however you would like.

Sites such as these may be of help for GIF files, for example:
  • http://ptolemy.eecs.berkeley.edu/eecs20/sidebars/images/gif.html
  • http://schmidt.devlib.org/file-formats/gif-image-file-format.html

    Or, more generally, you can google something like GIF image format, or whatever file format you are interested in.

    Basically, once you open the file (probably in binary mode), it's a matter of pulling out the right bytes and knowing what to do with them.

    Share this post


    Link to post
    Share on other sites
    java library for manipulating images. last i've seen there were alot of tutorials on it on the web too
    http://java.sun.com/products/java-media/jai/

    Share this post


    Link to post
    Share on other sites
    Sign in to follow this  

    • Advertisement
    ×

    Important Information

    By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

    GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

    Sign me up!