Solved

Rotate a Jpeg image 90 degrees

Posted on 1998-10-04
8
630 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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

747 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

14 Experts available now in Live!

Get 1:1 Help Now