Solved

Rotate a Jpeg image 90 degrees

Posted on 1998-10-04
8
651 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Docker-Compose to Simplify Multi-Container Builds

Our veteran DevOps Author takes you through how to build a multi-container environment, managed with a single utility in order to simplify your deployments.

 
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

Understanding Linux Permissions

Linux for beginners: How to view the permissions associated with files and directories and also how you can change them.

Question has a verified solution.

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

There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
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).

630 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