Solved

Rotate a Jpeg image 90 degrees

Posted on 1998-10-04
8
636 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
 
LVL 75

Expert Comment

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

Michel
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
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

3 Use Cases for Connected Systems

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

Question has a verified solution.

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

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.
"In order to have an organized way for empathy mapping, we rely on a psychological model and trying to model it in a simple way, so we will split the board to three section for each persona and a scenario and try to see what those personas would Do,…
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
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.

862 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now