Results 1 to 4 of 4
Thread: pixels and RGB of a .png file
- 01-06-2013, 11:58 PM #1
Member
- Join Date
- Jan 2013
- Location
- Deutschland
- Posts
- 2
- Rep Power
- 0
pixels and RGB of a .png file
hello everyone!
i started to learn java on my own, last night. i have had a little experience with c++ in the past.
i am doing an exercise where i should create a dialog to load a dark .png file, and then change its RGB values, so i could see the hidden image beyond the darkness.
i managed to make it load the file and show it (as a test), but i am really confused (specially towards definitions of classes and stuff) when it comes to getting the RGB values and changing them.
the following contains what i have done sofar:
Java Code:public class ImagePuzzle { public void solveBlackPuzzle() { Picture input = new Picture(FileChooser.pickAFile()); Picture output = null; if (input != null) { input.show(); ///////////////////////////////////////////////////// // HERE ARE THE THINGS DONE. i think. ////////////////////////////////////////////////////// output.show(); String directory = "/home/wilker/"; output.write(directory + "black-puzzle-solution.png"); } }
this "here are the things done" part, i am trying the following:
i have tried many things, watching videos, reading tutorials...but understand things better when i try it instead of reading about it...Java Code:method to decrease red get the pixels; define an integer that will work as a counter for (int= 0; i < my pixels number; i++) { p = pixels[i]; value = p.getRed(); (is getRed a method from color?) p.setRed(something....value*0,2) (is setRed a method from color?) now it should show the picture, with the red value changed... }
it either shows warnings that i am doing things in the wrong place...or it even compiles without major errors*, but it just open the input file dialog then shows it and thats it.
Obs: major errors*, because it seems some objects needed are in other classes, so i keep adding classes to my source (for example Picture, FileChooser, etc...) and it seems to be an infinite chain...to finally returns me an error like some weird library cant file a file, like:
and i dont even directly need this jpegimagestomovie thing...Java Code:NetBeansProjects/ImagePuzzle/src/Imagepuzzle/JpegImagesToMovie.java:41: package javax.media.datasink does not exist
sorry if i dont sound clear, but my thoughts are all loose..
thanks in advance and kind regards!
- 01-07-2013, 04:02 AM #2
Re: pixels and RGB of a .png file
Why do they call it rush hour when nothing moves? - Robin Williams
- 01-07-2013, 04:13 AM #3
Member
- Join Date
- Jan 2013
- Location
- Deutschland
- Posts
- 2
- Rep Power
- 0
Re: pixels and RGB of a .png file
hi,
yes, sorry. i am new to forums in general and had no aware that was a bad thing. just thought my chances would be higher if i had it in more places...
could you please, as moderator, delete it where you find proper to?
regards
- 01-07-2013, 07:02 AM #4
Re: pixels and RGB of a .png file
We don't delete threads just because the question has been cross posted. But we do keep other members informes so they can decide whether they still want to help.
Some do, some don't.
db
PS: look into using HSL color. Search Google and you can find Java implementations for converting between RGB and HSL (or HSB/HSI)Why do they call it rush hour when nothing moves? - Robin Williams
Similar Threads
-
help with some pixels
By HelloWorld1234 in forum New To JavaReplies: 13Last Post: 07-09-2012, 12:58 AM -
Pixels
By shakeel in forum Java 2DReplies: 0Last Post: 03-01-2011, 11:32 AM -
Image to pixels
By Deva in forum New To JavaReplies: 6Last Post: 04-01-2010, 08:35 PM -
get image file from array of pixels
By mester in forum Advanced JavaReplies: 1Last Post: 12-28-2008, 10:38 AM -
Counting Pixels
By shaungoater in forum Java 2DReplies: 5Last Post: 11-29-2007, 05:51 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks