How to process images(Zooming) in java
Hai,
In our project,i need to provide an option to the end user to zoom the image, i am able to provide options like rotating an image and flipping an image using java image processing API. If anybody has already visited the website http://photo.stamps.com/PhotoStamps/?source=cj00470773, where we can also zoom a photo(they done it using Flash). My requirement is similar to this site.
I would be greatful if anybody can suggest me about how to zoom images using Java
Thanks
PRAMOD.
Hi,
You can use AffineTransform to scale an image.
/Kaj
Similar Messages
-
How to add images into a java application (not applet)
Hello,
I am new in java programming. I would like to know how to add images into a java application (not an applet). If i could get an standard example about how to add a image to a java application, I would apreciated it. Any help will be greatly apreciated.
Thank you,
OscarYour' better off looking in the java 2d forum.
package images;
import java.awt.*;
import java.awt.image.*;
import java.io.FileInputStream;
import javax.imageio.ImageIO;
import javax.swing.*;
/** * LogoImage is a class that is used to load images into the program */
public class LogoImage extends JPanel {
private BufferedImage image;
private int factor = 1; /** Creates a new instance of ImagePanel */
public LogoImage() {
this(new Dimension(600, 50));
public LogoImage(Dimension sz) {
//setBackground(Color.green);
setPreferredSize(sz);
public void setImage(BufferedImage im) {
image = im;
if (im != null) {
setPreferredSize(
new Dimension(image.getWidth(), image.getHeight()));
} else {
setPreferredSize(new Dimension(200, 200));
public void setImageSizeFactor(int factor) {
this.factor = factor;
public void paintComponent(Graphics g) {
super.paintComponent(g);
//paint background
Graphics2D g2D = (Graphics2D) g;
//Draw image at its natural size first.
if (image != null) {
g2D.drawImage(image, null, 0, 0);
public static LogoImage createImage(String filename) { /* Stream the logo gif file into an image object */
LogoImage logoImage = new LogoImage();
BufferedImage image;
try {
FileInputStream fileInput =
new FileInputStream("images/" + filename);
image = ImageIO.read(fileInput);
logoImage =
new LogoImage(
new Dimension(image.getWidth(), image.getHeight()));
fileInput.close();
logoImage.setImage(image);
} catch (Exception e) {
System.err.println(e);
return logoImage;
public static void main(String[] args) {
JFrame jf = new JFrame("testImage");
Container cp = jf.getContentPane();
cp.add(LogoImage.createImage("logo.gif"), BorderLayout.CENTER);
jf.setVisible(true);
jf.pack();
}Now you can use this class anywhere in your pgram to add a JPanel -
How to create image dynamically in Java
Hi
I am new to image API.
My requirement is, I need to write some data (for example string line by line) and want to save it as JPG file in my local system.
Can some one please post the sample code.
Thanks in Advance
Kris
Message was edited by:
kris-helpI am not understanding how to proceed.
If I have any sample code it is going to be very helpful.
Someone please post the code.
Thanks in advance. -
How to produce image map with java servlet?
Hello,
I know the way to produce an image map from a static image. And I also know how to use ServeltOutputStream to generate an image on the fly. But I don't know how to use the dynamically generated image to produce an image map. Can anyone help me? Thanks a lot!
LouisThe database is a BioSQL database and I am using Biojava "BioSQLSequenceDB class" to access it. Sorry I don't really know the schema of the BioSQL
The easiest example is to ignore the database totally.
At the moment, I just want to do the folloing thing:
1. Use HTML form to retireve the height and length of a rectangle that user specified
2. draw the rectangle on the fly
3. make the rectangle a hyper link to an HTML documet, which represents "Hello world" to the user
Could you show me how to do it please?
Thanks very much.
Louis -
How to process images in service mode
I am trying to build an image processing utility that can be used as a service (without UI).
I tried to use the JIU project utilities: [http://schmidt.devlib.org/jiu/index.html], and discovered it doesn't work properly in service mode.
Where can I find code samples for images manipulation in service mode(without UI)?
Thanks in advance,
AsafHi,
You can use AffineTransform to scale an image.
/Kaj -
hi all,
I am trying to save an image (blob) into oracle. When i try this i am getting following error.
java.sql.SQLException: ORA-01465: invalid hex number
BLOB blob = BLOB.createTemporary(con , false, BLOB.DURATION_SESSION);
String dir = "C:\\opt\\temp";
File binaryFile = new File(dir+"/"+filename);
FileInputStream instream = new FileInputStream(binaryFile);
OutputStream outstream = blob.setBinaryStream(1L);
int size = blob.getBufferSize();
byte[] buffer = new byte[size];
int length = -1;
while ((length = instream.read(buffer)) != -1)
outstream.write(buffer, 0, length);
instream.close();
outstream.close();
System.out.println("blob:>>>>>>"+blob);
String sqlText =
"INSERT INTO test_fileupload (filename, blobfile) " +
" VALUES('" + filename + "','" + outstream + "')";
st.executeUpdate(sqlText);
con.commit();In the above Insert statement i tried with "blob" insted of "outstream" still same but when i try with the string "3s34se"
it is inserting into database..
I am new to blob can any one explain me why is like that.
Thanq in adv.
Edited by: Ajayuppalapati on Nov 21, 2008 4:40 PMORA-01465: invalid hex number
[http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=3&t=012434]
[http://forums.sun.com/thread.jspa?threadID=261091&forumID=31] -
Needed help in: how to import image in InDesign Server using Java Code
New to InDesign Server.
I am not been able to import image to document.
I tried to import image using the sample snippets "PlaceTextFileInFrame.java".
modified the line:
String placefilepath = "C:\\placeFile.txt";
to
String placefilepath = "C:\\Image.jpg";
myTextFrame.place(placefilepath);
Is this the correct way to import image or there is another solution.
1.The image gets imported but i am getting blur image(Zoomed image).
2.The image gets imported to its original image width & height.
3.I need to know how to set the image width & size.My Requirement is-- I ve to connect to msn search page in order retrieve the result set from msn search. The same code which I do pasted below is working for GOOGLE n YAHOO with minor changes.But not for MSN.., Can any one help me.
I've pasted the code for msn..,
import java.io.*;
import java.net.*;
public class File {
public static void main(String[] args) throws IOException {
Socket s = new Socket("search.live.com", 80);
String query = "java";
PrintStream p = new PrintStream(s.getOutputStream());
p.print("GET /results.aspx?q=" + query);
p.print("User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0\r\n");
p.print("Connection: close\r\n\r\n");
InputStreamReader in = new InputStreamReader(s.getInputStream());
BufferedReader buffer = new BufferedReader(in);
String line;
while ((line = buffer.readLine()) != null) {
System.out.println(line);
Edited by: Lijo_Java on Jul 13, 2008 9:03 PM -
How to add an image to an IMAGE control in Java WebDynpro
hi
How to add an image to an IMAGE control in Java WebDynpro.
Please give me the steps to assign an image to an IMAGE control.
Advanced Thanks
brahmaThank You Mathan MP,
i tried these steps, but whenever i selected the source property of image UI control, it opens a context window, but this context window does't contain any thing for selection.
so how to solve this problem ?
the link whatever u provided is not opened, please send the correct link.
http://127.0.0.1:1284/help/index.jsp?topic=/com.sap.devmanual.doc.user/f3/1a61a9dc7f2e4199458e964e76b4ba/content.htm
Thanks in Advance
brahma -
How to embed the Images in the java sourse
How to embed the Images in the java sourse
The size of the file will be too large while I put the binary code of the image into the java sourse!
thanksYou could encrypt them with a private key and then
decrypt them with a public key.
Almost had it... public key encryption works the other
way around... otherwise what's the point of
encrypting... if the decryption key is public?Spinoza's right. Public key encryption works both ways, but it would be useless in this case to encrypt with the private key. The problem is, how do you package your private key with the application in a way that doesn't allow the user to get it? Encrypt it? :-) I agree that there's no point to this exercize. If users want to screw up the application by editing its image files, let 'em. -
How to send image as a part of body with java mail
How to send image (.GIF) file in mail body & not as an attachement using java mail API
You need to create a multipart/related message.
You'll probably find examples in this forum. -
How to store images in database using java
hii
how to store images in database using java..........
Message was edited by:
naveennagaI asked a similar question once and the answer I got was - Don't.
Instead, store the images on a drive somewhere and store the path in the database.
But I'm no expert - that's just what I was told by someone who does this kind of stuff a lot.
Hope that helps. -
How to resize image using java imageio
Hello ,
I want to know how to resize image using java imageio.
I dont want to use java awt because i am writing a web application.
help is very much needed
thank you.Just use an AffineTransform !
Its much easier -
How to convert image to array pixel values in java
I would like to know how to convert image into arrary of pixels in java ?
which API should i use ?
please give me link to a sample program !I find the most efficient way to just walk over the image and call getRGB(x,y) on every pixel, more so than Pixelgrabber. If someone knows a more efficient way, give me a beep.
-
How to import the image by using java application
1.how to import the image by using java APPLICATION and display it on the textarea that you have been created.
2.how to store the image into the file.
3. what class should i used?
4. how to create an object to keep track the image in java application.
* important : not java applet.
plzzzzzzz.
regards fennyfollow the link:
http://java.sun.com/docs/books/tutorial/2d/images/index.html -
How can I put an image/s in Java Application?
Hi to all.
How can I put an image/s in Java Application?
I can put some images in Java applet but when i try to put it in Java application there was an error.hey u can easily do it with JLabels...i found a Code Snippet for u
public class MyPanel extends JPanel
{private JLabel imageLabel; public MyPanel() { Image image = Toolkit.getDefaultToolkit().getImage("myimage.gif"); // Could be jpg or png too imageLabel = new JLabel(new ImageIcon(image)); this.add(imageLabel); }}
hope it helps
Cheers,
Manja
Maybe you are looking for
-
Hi Gurus, I am woking on an interface where I need to use BAPI for PO creation for multiple line items and for this I have written the following code: *& Report Z_TEST1 * REPORT Z_TEST1 . inter
-
Interactive PDF created in InDesign CS6 crashes Acrobat XI
Just finished laying out an interactive document in InDesign and exporting to as an interactive PDF to Acrobat. The document is 48 pages and has 3 pop-up TOC's for each of the 3 sections. There are several other hyperlinks, top and bottom nav menus.
-
Brand new out of the box and plugged in. Amber light just keeps flashing and is not reconized by my desktop or my laptop. Software was installed on both and I have a Extreme base station. HELP
-
Number range "change document" problem
Hi Some body has changed the number range group in production server for specific order type.Can i trace the user id who has done this changes, is there any log generated for number range group changing as no transport request is generated. I have ch
-
How can I read errors/exceptions from my JAR?
My application is running fine from JBuilder, where I am writing it, but when I go to My Computer and try to run the .jar file, nothing is happenning. Is there a way for me to view the error messages/exceptions that are thrown from the Jar? Can I ope