Solved

Rotate a Jpeg image 90 degrees

Posted on 1998-10-04
8
642 Views
Last Modified: 2013-12-25
WHere can I find some C source that will allow me to read a jpeg image rotate it and write it out? OR a plug-in that will allow a jpeg image to be rotated on a web page?
THanks in advance..

Randall
0
Comment
Question by:rcashon
8 Comments
 

Expert Comment

by:sasidhar
ID: 1865745
search in yahoo with keyword IMAGE FORMAT.u will find
a plenty of routines in diffent platforms.
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 1865746
Your best bet here is Java. Java 1.1 has built-in functions for cropping, streching and rotating gif and jpg and if the functions are made public, JavaScript can control it.

Michel
0
 
LVL 2

Expert Comment

by:SirCaleb
ID: 1865747
well, depending on your specific preferences...couldn't you just have another image that was the same image just sideways?
0
How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 1865748
I think rcashon wants to save space and download time...

Michel
0
 
LVL 1

Author Comment

by:rcashon
ID: 1865749
Sorry to reject your answer sasidhar. I have been all over the web searching for some source.

Michel,
 You hit the nail on the head for me. I need a java applet that can rotate a jpeg. Repost your comment for the points.  

Thanks to both of you for the reponces...

Randall

0
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 20 total points
ID: 1865750
Your best bet here is Java. Java 1.1 has built-in functions for cropping, streching and rotating gif and jpg and if the functions are made public, JavaScript can control it.

       Michel

Thanks.

I have seen the code in Java in a Nutshell. I can post some if you wish?
0
 
LVL 1

Author Comment

by:rcashon
ID: 1865751
michel, Thanks I would greatly appreciate the code. I have been torn BTW writing some C code (which I still want to do  ) to read a jpeg file and rotate it or as you suggested to use a java applet and go that route. SirCaleb - you are correct in your statement. That is what I was what I was going to do with the C code. I was going to read in the image file rotate it and redisplay it. I just have not found any C code to facilitate that yet. Hopefully the applet code will do what I am wanting to do .
Thanks again...

Randall
 
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 1865752
Here you are:

// This example is from _Java Examples in a Nutshell_. (http://www.oreilly.com)
// Copyright (c) 1997 by David Flanagan
// This example is provided WITHOUT ANY WARRANTY either expressed or implied.
// You may study, use, modify, and distribute it for non-commercial purposes.
// For any commercial use, see http://www.davidflanagan.com/javaexamples

import java.applet.*;
import java.awt.*;

/** An applet that demonstrates image scaling, cropping, and flipping */
public class ImageSampler extends Applet {
  Image i;

  /** Load the image */
  public void init() {  i = getImage(this.getDocumentBase(), "tiger.gif"); }

  /** Display the image in a variety of ways */
  public void paint(Graphics g) {
    g.drawString("Original image:", 20, 20);     // Display original image
    g.drawImage(i, 110, 10, this);               // Old version of drawImage()

    g.drawString("Scaled Images:", 20, 120);     // Display scaled images
    g.drawImage(i, 20, 130, 40, 150, 0, 0, 100, 100, this);  // New version
    g.drawImage(i, 60, 130, 100, 170, 0, 0, 100, 100, this);
    g.drawImage(i, 120, 130, 200, 210, 0, 0, 100, 100, this);
    g.drawImage(i, 220, 80, 370, 230, 0, 0, 100, 100, this);

    g.drawString("Cropped Images:", 20, 250);    // Display cropped images
    g.drawImage(i, 20, 260, 70, 310, 0, 0, 50, 50, this);
    g.drawImage(i, 80, 260, 130, 310, 25, 25, 75, 75, this);
    g.drawImage(i, 140, 260, 190, 310, 50, 50, 100, 100, this);

    g.drawString("Flipped Images:", 20, 330);    // Display flipped images
    g.drawImage(i, 20, 340, 120, 440, 100, 0, 0, 100, this);
    g.drawImage(i, 130, 340, 230, 440, 0, 100, 100, 0, this);
    g.drawImage(i, 240, 340, 340, 440, 100, 100, 0, 0, this);

    g.drawString("Scaled, Cropped, and Flipped:", 20, 460);  // Do all three
    g.drawImage(i, 20, 470, 170, 550, 90, 70, 10, 20, this);
  }
}

0

Featured Post

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Envision that you are chipping away at another e-business site with a team of pundit developers and designers. Everything seems, by all accounts, to be going easily.
Get to know the ins and outs of building a web-based ERP system for your enterprise. Development timeline, technology, and costs outlined.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

790 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question