|
From: Naresh <baf...@ya...> - 2012-01-06 10:42:40
|
It worked!
I did
./configure --with-java-home=/Library/Java/Home --with-java-includes=/System/Library/Frameworks/JavaVM.framework/Headers
make all
make install
Now, only if there was a way for me to commit these changes to the svn repo.
Cheers!
________________________________
From: Mike Larson <lar...@ya...>
To: Naresh <baf...@ya...>; "jma...@li..." <jma...@li...>
Sent: Thursday, January 5, 2012 7:47 PM
Subject: Re: [Jmagick-users] jmagick setQuality method
Yes - i believe after you build it, you have to make sure to replace all copies of your libJMagick.so and jmagick.jar with the new ones you just built (do a find on the machine to ensure there are no old ones on there). It may be that your code is trying to link to the old native library where the method doesn't exist.
(I can say it is definitely possible to get the getQuality method to work - just takes some persistence)
I also made a simple tester app to resize and then save 2 images - of quality 50 and 100 just to compare file sizes:
public class JMagickTest {
public static void main(String[] args)
{
System.out.println("Starting JMagick image tester");
String filePathIn = "/Images/test1.jpg";
String filePathOut100 = "/Images/test2_100.jpg";
String filePathOut50 = "/Images/test2_50.jpg";
System.out.println("Using test image: " + filePathIn);
ImageInfo info = null;
MagickImage image =
null;
Dimension orgDim = null;
try {
System.out.println("Creating ImageInfo");
info = new ImageInfo(filePathIn);
System.out.println("Instantiating MagickImage");
image = new
MagickImage(info);
System.out.println("Getting MagickImage dimensions");
orgDim = image.getDimension();
System.out.println("PixelWidth is "+ orgDim.width);
System.out.println("PixelHeight is "+ orgDim.height);
System.out.println("Resizing image to 100x100");
MagickImage lrgImage = image.scaleImage(100, 100);
System.out.println("Resized image");
System.out.println("Output path 100 = " + filePathOut100);
System.out.println("Output path 50 = " + filePathOut50);
lrgImage.setCompression(CompressionType.JPEGCompression);
lrgImage.setMagick("JPG");
int quality = 100;
lrgImage.setQuality(quality);
lrgImage.setImageFormat("JPG");
System.out.println("Saving image with quality: " + quality);
lrgImage.setFileName(filePathOut100);
lrgImage.writeImage(new ImageInfo());
System.out.println("Saved: " + filePathOut100);
quality = 50;
lrgImage.setQuality(quality);
lrgImage.setImageFormat("JPG");
System.out.println("Saving image with quality: " + quality);
lrgImage.setFileName(filePathOut50);
lrgImage.writeImage(new ImageInfo());
System.out.println("Saved: " + filePathOut50);
System.out.println("Cleaning
up");
lrgImage.destroyImages();
lrgImage = null;
image.destroyImages();
image=null;
Runtime r = Runtime.getRuntime();
r.gc();
System.out.println("Collected Garbage");
}catch(MagickException e){
System.out.println("Got exception:");
e.printStackTrace();
}
System.out.println("Finished JMagick image tester");
}
________________________________
From: Naresh <baf...@ya...>
To: Mike Larson <lar...@ya...>; "jma...@li..." <jma...@li...>
Sent: Thursday, January 5, 2012 8:53 AM
Subject: Re: [Jmagick-users] jmagick setQuality method
Thanks for taking the time to reply.
I tried doing something similar but got the following error
Exception in thread "main" java.lang.UnsatisfiedLinkError: magick.MagickImage.setQuality(I)V
I made the following changes in the C and Java code
magick_MagickImage.c
Added this line
/*
* Class: magick_MagickImage
* Method: setQuality
* Signature: (I)V
*/
setIntMethod(Java_magick_MagickImage_setQuality,
quality,
"magickImageHandle",
Image)
MagickImage.java
/**
* Set the quality attribute of the image.
* @param quality the
* @see Quality
* @exception MagickException on error
*/
public native void setQuality(int quality)
throws MagickException;
It would be extremely helpful if you can share the changes you made or point out what I might be missing.
________________________________
From: Mike Larson <lar...@ya...>
To: Naresh <baf...@ya...>; "jma...@li..." <jma...@li...>
Cc: "jma...@li..." <jma...@li...>
Sent: Thursday, January 5, 2012 6:10 PM
Subject: Re: [Jmagick-users] jmagick setQuality method
I faced the exact same problem. I added setQuality on the MagickImage in the C++ and java code and recompiled (after googling this issue for several days). It doesn't work to use the setQuality method on the info object...
Mike
On Jan 5, 2012, at 1:21, "Naresh" <baf...@ya...> wrote:
Hi All,
>
>
>I
am facing the following problem.
>
>The following code always prints 100
>
>ImageInfo info = new ImageInfo(fileName);
>info.setQuality(90);
>MagickImage image = new MagickImage(info);
>System.out.println("quality is "+image.getQuality());
>
>Also, I did not find the setQuality method in the MagickImage class.
>
>This makes the size of my images greater than by a factor of 2.
>
>I am using ImageMagick 6.7.1-1 , jmagick-6.5.7.jar and Mac Lion.
>
>Has anyone faced a similiar
problem? It would be helpful if anyone can share pointers to this.
>
>
>
------------------------------------------------------------------------------
>Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
>infrastructure or vast IT resources to deliver seamless, secure access to
>virtual desktops. With this all-in-one solution, easily deploy virtual
>desktops for less than the cost of PCs and save 60% on VDI infrastructure
>costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
>Jmagick-users mailing list
>Jma...@li...
>https://lists.sourceforge.net/lists/listinfo/jmagick-users
> |