944,008 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 9422
  • Java RSS
You are currently viewing page 1 of this multi-page discussion thread
Aug 2nd, 2005
0

Can I make a Java Image Editing Photshop-like program

Expand Post »
Hi Everybody,

I was wondering how to make a java image editing application. Basically, I really want to make a program that allows the user to drag and stretch images. I don't want the code. I'm only in search of a decent tutorial.

Thanks in advanced for your help.
Reputation Points: 12
Solved Threads: 2
Posting Whiz
Ghost is offline Offline
352 posts
since Aug 2004
Aug 3rd, 2005
0

Re: Can I make a Java Image Editing Photshop-like program

Should be lots of resources on this. Check out the Java Tutorials http://java.sun.com/docs/books/tutorial/index.html and also the demos that you will have recieved in your sdk.

There are two features of Java that make it easy to do this kind of thing.
1. The API contains support for viewing many graphic types by default.
2. The Graphic Components in Java allow you to extract the displayed Graphics object, that you may then manipulate as you see fit and export to file.

Have fun.
Reputation Points: 20
Solved Threads: 5
Junior Poster
alpha_foobar is offline Offline
182 posts
since May 2005
Aug 3rd, 2005
0

Re: Can I make a Java Image Editing Photshop-like program

hi,

For drag and drop you can try java.awt.datatransfer API. For scaling the images try java.awt.Image method getScaledInstance(int width, int height, int hints) and other related api.

Hope this helps
Regards
Srinivas
Reputation Points: 10
Solved Threads: 0
Light Poster
cheenu78 is offline Offline
45 posts
since Jun 2005
Aug 3rd, 2005
0

Re: Can I make a Java Image Editing Photshop-like program

thanks for your replies!

sorry if i wasn't clear in my question, but how do you distort the image (make someone's smile bigger, etc.). I think the feature in photoshop is called liquify.

Thanks again for your help.
Reputation Points: 12
Solved Threads: 2
Posting Whiz
Ghost is offline Offline
352 posts
since Aug 2004
Aug 3rd, 2005
0

Re: Can I make a Java Image Editing Photshop-like program

You need to access the pixels directly. Then you can do any thing you want with the image. To do this you use:

java.awt.image.PixelGrabber

Then it all gets down to doing the "math" on the pixels to do the effect you want.

Jeff
http://www.heatonresearch.com
Reputation Points: 12
Solved Threads: 0
Junior Poster in Training
JeffHeaton is offline Offline
58 posts
since Jul 2005
Aug 3rd, 2005
0

Re: Can I make a Java Image Editing Photshop-like program

Jeff,

Thank you! I think I already know how to use PixelGrabber (I think I used it in another on another one of my programs). It's actually the math part that I need help with.

Thanks again.
Reputation Points: 12
Solved Threads: 2
Posting Whiz
Ghost is offline Offline
352 posts
since Aug 2004
Aug 3rd, 2005
0

Re: Can I make a Java Image Editing Photshop-like program

The math part is language independent.
There are books about image manipulation out there, many highly theoretical.
Lowpass and highpass filters work essentially the same as in electronics, so filter theory books for that should work as well.

Start out writing a simple filter, and work your way up
Essentially a basic filter takes a pixel and based on its value and a mathematical formula performs some operation on pixels surrounding it.
For example, a very simple filter indeed would just decrease that value by a set amount:
Java Syntax (Toggle Plain Text)
  1. ---------------
  2. | -1 | -1 | -1 |
  3. | -1 | 0 | -1 |
  4. | -1 | -1 | -1 |
  5. ---------------

If you consider a pixel to be a single value (greyscale) for now, putting this matrix over a pixel would decrease (darken) all pixels surrounding it slightly.
That's the easiest example. Once you get something like this working, more complex filters are possible to do things like edge detection and working on larger areas.

But the math involved quickly gets rather complex. Now I don't mind complex math (it used to be a hobby of mine as well as part of my study) but I'm no expert at this and my knowledge is rather rusty.
Team Colleague
Reputation Points: 1658
Solved Threads: 331
duckman
jwenting is offline Offline
7,719 posts
since Nov 2004
Aug 3rd, 2005
0

Re: Can I make a Java Image Editing Photshop-like program

I thought it was a lot of bit flipping and crap like that involved. I doubt just one person can write a full fledged photoshop by themeself.
Reputation Points: 113
Solved Threads: 19
Postaholic
server_crash is offline Offline
2,108 posts
since Jun 2004
Aug 3rd, 2005
0

Re: Can I make a Java Image Editing Photshop-like program

Thanks, guys!

jwenting - would you usee PixelGrabber to grab the pixels and then decrease all of them by 1 to darken the image? Could you do the same thing and increase it by 1 to brighten the image? Thanks. Also, does this work on color images, or only greyscale?

Thanks again.
Reputation Points: 12
Solved Threads: 2
Posting Whiz
Ghost is offline Offline
352 posts
since Aug 2004
Aug 3rd, 2005
0

Re: Can I make a Java Image Editing Photshop-like program

I don't know what to use to get the pixels (like I said, I've never done anything like this in Java, last time was C++ under DOS).
Best way would be to get access to the raw image data and manipulate that, would certainly be a lot faster.

You can apply filters to do pretty much anything. Where I put -1 for each, you could have any combination of values including mathematical functions, possibly different for each pixel.
Team Colleague
Reputation Points: 1658
Solved Threads: 331
duckman
jwenting is offline Offline
7,719 posts
since Nov 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: Need help with Tree structure
Next Thread in Java Forum Timeline: how to pass values in java





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC