• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Resizing images
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Resizing images


  • Subject: Re: Resizing images
  • From: Pascal Robert <email@hidden>
  • Date: Mon, 4 Feb 2008 11:59:32 -0500

Ah yeah, good old QuickDraw stuff :-) I do like QT4J (I'm also using it for image stuff), but since it's a JNI layer on top of the old QT C API, I'm not sure it have a future.

You can use QT4J. Here are some code snippets to put you on the right track...

// opens, scales and saves images again.
QTSession.open();
QTFile file1 = new QTFile(location);
GraphicsImporter gi1 = new GraphicsImporter(file1);
Matrix matrix = new Matrix();
MediaUtilities.scaleImage(gi1, matrix, 200, 200);
GraphicsExporter exporter = new GraphicsExporter (StdQTConstants.kQTFileTypeJPEG);
exporter.setInputGraphicsImporter(gi1);
exporter.setOutputFile(file1);
exporter.doExport();
QTSession.close();



// scales the given image if width or height is greater then max width and height passed in
static public void scaleImage(GraphicsImporter gi, Matrix matrix, int maxWidth, int maxHeight) {


		try {
			QDRect bounds = gi.getBoundsRect();
			// maxWidth or maxHeight / x and y gives scaling factor for x and y
			float currentX = bounds.getWidth();
			float currentY = bounds.getHeight();
			float scaleX = 1f;
			float scaleY = 1f;
			if (currentX > maxWidth) {
				scaleX = (maxWidth / currentX);
			}
			if (currentY > maxHeight) {
				scaleY = (maxHeight / currentY);
			}

			matrix.scale(scaleX, scaleY, 0, 0);
			gi.setMatrix(matrix);
		} catch (StdQTException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}


Simon


On 4 Feb 2008, at 16:47, Mike Schrag wrote:

I use a JNI wrapper around OS X's CoreImage/ImageIO ... It kicks the butt (by at least an order of magnitude and sometimes more) of any other method on OS X.

ms

On Feb 4, 2008, at 11:31 AM, Miguel Arroz wrote:

Hi!

Just to know, what library do you use to manipulate images (getting X and Y size, resizing, etc)? Do you use the standard Java stuff, or anything else better/faster?

 Yours

Miguel Arroz

Miguel Arroz
http://www.terminalapp.net
http://www.ipragma.com



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40mdimension.com


This email sent to email@hidden


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40mac.com


This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Resizing images (From: Miguel Arroz <email@hidden>)
 >Re: Resizing images (From: Mike Schrag <email@hidden>)
 >Re: Resizing images (From: Simon McLean <email@hidden>)

  • Prev by Date: Re: Resizing images
  • Next by Date: Re: Resizing images
  • Previous by thread: Re: Resizing images
  • Next by thread: Re: Resizing images
  • Index(es):
    • Date
    • Thread