User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Java section within the Software Development category of DaniWeb, a massive community of 391,713 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,421 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Java advertiser: Lunarpages Java Web Hosting
Views: 2973 | Replies: 14
Reply
Join Date: Aug 2004
Location: Los Angeles
Posts: 343
Reputation: Ghost is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 2
Ghost's Avatar
Ghost Ghost is offline Offline
Posting Whiz

Help Can I make a Java Image Editing Photshop-like program

  #1  
Aug 2nd, 2005
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.
CRD
Join the CRD forums! If you're one of the first 4 people to post in a topic, you get FREE web hosting with:
Apache WWW Host
Unlimited (within reason) storage
Unlimited (within reason) bandwith
PHP
mySQL
FTP
Unlimited Subdomains Hosted
Unlimited Domains Hosted

ALL FREE!!

Click here to visit
AddThis Social Bookmark Button
Reply With Quote  
Join Date: May 2005
Location: Wellington, New Zealand
Posts: 182
Reputation: alpha_foobar is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 3
alpha_foobar's Avatar
alpha_foobar alpha_foobar is offline Offline
Junior Poster

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

  #2  
Aug 2nd, 2005
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.
Reply With Quote  
Join Date: Jun 2005
Location: india
Posts: 44
Reputation: cheenu78 is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
cheenu78's Avatar
cheenu78 cheenu78 is offline Offline
Light Poster

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

  #3  
Aug 2nd, 2005
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
We come to love not by finding a perfect person, but by learning to see an imperfect person perfectly.

-Sam Keen, from To Love and Be Loved
Reply With Quote  
Join Date: Aug 2004
Location: Los Angeles
Posts: 343
Reputation: Ghost is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 2
Ghost's Avatar
Ghost Ghost is offline Offline
Posting Whiz

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

  #4  
Aug 3rd, 2005
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.
CRD
Join the CRD forums! If you're one of the first 4 people to post in a topic, you get FREE web hosting with:
Apache WWW Host
Unlimited (within reason) storage
Unlimited (within reason) bandwith
PHP
mySQL
FTP
Unlimited Subdomains Hosted
Unlimited Domains Hosted

ALL FREE!!

Click here to visit
Reply With Quote  
Join Date: Jul 2005
Posts: 58
Reputation: JeffHeaton is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
JeffHeaton's Avatar
JeffHeaton JeffHeaton is offline Offline
Junior Poster in Training

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

  #5  
Aug 3rd, 2005
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
Reply With Quote  
Join Date: Aug 2004
Location: Los Angeles
Posts: 343
Reputation: Ghost is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 2
Ghost's Avatar
Ghost Ghost is offline Offline
Posting Whiz

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

  #6  
Aug 3rd, 2005
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.
CRD
Join the CRD forums! If you're one of the first 4 people to post in a topic, you get FREE web hosting with:
Apache WWW Host
Unlimited (within reason) storage
Unlimited (within reason) bandwith
PHP
mySQL
FTP
Unlimited Subdomains Hosted
Unlimited Domains Hosted

ALL FREE!!

Click here to visit
Reply With Quote  
Join Date: Nov 2004
Location: Netherlands
Posts: 5,646
Reputation: jwenting is a jewel in the rough jwenting is a jewel in the rough jwenting is a jewel in the rough jwenting is a jewel in the rough 
Rep Power: 18
Solved Threads: 191
Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

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

  #7  
Aug 3rd, 2005
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:
---------------
| -1 | -1 | -1 |
| -1 |  0 | -1 |
| -1 | -1 | -1 |
---------------

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.
42 Private messages asking for help will be ignored
In the frozen land of Nador they were forced to eat Steve's iMinstrels, and there was much rejoicing.
Reply With Quote  
Join Date: Jun 2004
Location: H4x0rville
Posts: 2,105
Reputation: server_crash is on a distinguished road 
Rep Power: 9
Solved Threads: 18
server_crash's Avatar
server_crash server_crash is offline Offline
Postaholic

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

  #8  
Aug 3rd, 2005
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.
Reply With Quote  
Join Date: Aug 2004
Location: Los Angeles
Posts: 343
Reputation: Ghost is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 2
Ghost's Avatar
Ghost Ghost is offline Offline
Posting Whiz

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

  #9  
Aug 3rd, 2005
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.
CRD
Join the CRD forums! If you're one of the first 4 people to post in a topic, you get FREE web hosting with:
Apache WWW Host
Unlimited (within reason) storage
Unlimited (within reason) bandwith
PHP
mySQL
FTP
Unlimited Subdomains Hosted
Unlimited Domains Hosted

ALL FREE!!

Click here to visit
Reply With Quote  
Join Date: Nov 2004
Location: Netherlands
Posts: 5,646
Reputation: jwenting is a jewel in the rough jwenting is a jewel in the rough jwenting is a jewel in the rough jwenting is a jewel in the rough 
Rep Power: 18
Solved Threads: 191
Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

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

  #10  
Aug 3rd, 2005
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.
42 Private messages asking for help will be ignored
In the frozen land of Nador they were forced to eat Steve's iMinstrels, and there was much rejoicing.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb Java Marketplace
Thread Tools Display Modes

Other Threads in the Java Forum

All times are GMT -4. The time now is 3:11 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC