Re: [Resin-interest] help on resizing image

2013-03-14 Thread Riccardo Cohen
Hello
After some test with jmagick, I found the solution difficult to rely on :
- difficult to compile (but succeed at the end)
- unstable (some jvm crash)
- outputting some unwanted report on stdout (could not stop the verbose 
option)
- strange API (which is not the main point)

I finally go back to 100% pure java with awt, but with headless=true 
which sould solve my problem.

Thanks

On 07/02/13 11:25, Mattias Jiderhamn wrote:
 We use JAI in one of our web apps. Have you set system properties
 java.awt.headless=true and java.awt.headlesslib=true ...?

 (Btw, for full performance, you should install JNI binaries. Thought
 that wouldn't be 100% Java either. And I haven't tried it.)

/Mattias

 - Original Message -
 Subject: [Resin-interest] help on resizing image
 Date: Thu, 07 Feb 2013 11:14:00 +0100
 From: Riccardo Cohen r.co...@realty-property.com

 Hello
 On my web application, I need to resize images sent via multipart forms.

 When I try a console application using awt on my mac (see attached
 code), the console application starts a real Mac application with window
 and menu, while my code is only calling non-gui functions
 (ImageIO.read...) .

 I'm really affraid to add this code on my server, and I wonder if this
 may have impact on memory, performance and stability of the server. I
 would rather prefer a little imaging library like jmagick or gd for
 java, small and efficient. It's not 100% java but it does not create
 windows and menus...

 What do you use to resize images on the server size ?
 Thanks a lot.


-- 
Riccardo Cohen
+33 (0)6 09 83 64 49
Société Realty-Property.com
1 rue de la Monnaie
37000 Tours
France

http://www.appartement-maison.fr

___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest


[Resin-interest] help on resizing image

2013-02-07 Thread Riccardo Cohen

Hello
On my web application, I need to resize images sent via multipart forms.

When I try a console application using awt on my mac (see attached 
code), the console application starts a real Mac application with window 
and menu, while my code is only calling non-gui functions 
(ImageIO.read...) .


I'm really affraid to add this code on my server, and I wonder if this 
may have impact on memory, performance and stability of the server. I 
would rather prefer a little imaging library like jmagick or gd for 
java, small and efficient. It's not 100% java but it does not create 
windows and menus...


What do you use to resize images on the server size ?
Thanks a lot.

--
Riccardo Cohen
+33 (0)6 09 83 64 49
Société Realty-Property.com
1 rue de la Monnaie
37000 Tours
France

http://www.appartement-maison.fr

import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;

public class Main {
public static void main(String[] args)
{
String mode = draw;

BufferedImage image1 = null;
BufferedImage image2 = null;
BufferedImage image3 = null;

BufferedImage image1_converted = null;
BufferedImage image2_converted = null;
BufferedImage image3_converted = null;

String path1 = images/image1.jpg;
String path2 = images/image2.gif;
String path3 = images/image3.png;

String ext1 = jpg;
String ext2 = gif;
String ext3 = png;

int outputWidth = 200;
int outputHeight = 100;

try{
image1 = ImageIO.read(new File(path1));
}catch(IOException ex){System.out.println(Iexeption 
image1);ex.printStackTrace();}
try{
image2 = ImageIO.read(new File(path2));
}catch(IOException ex){System.out.println(Iexeption image2); 
ex.printStackTrace();}
try{
image3 = ImageIO.read(new File(path3));
}catch(IOException ex){System.out.println(Iexeption image3); 
ex.printStackTrace();}

int width1 = image1.getWidth();
int height1 = image1.getHeight();
int width2 = image2.getWidth();
int height2 = image2.getHeight();
int width3 = image3.getWidth();
int height3 = image3.getHeight();

System.out.println(path1);
System.out.println(width :  + width1);
System.out.println(height :  + height1);

System.out.println(\n + path2);
System.out.println(width :  + width2);
System.out.println(height :  + height2);

System.out.println(\n + path3);
System.out.println(width :  + width3);
System.out.println(height :  + height3);

if(mode.equals(resize))
{
image1_converted = new BufferedImage(outputWidth, 
outputHeight, image1.getType());
Graphics2D g1 = image1_converted.createGraphics();
g1.drawImage(image1, 0, 0, outputWidth, outputHeight, 
null);
g1.dispose();

image2_converted = new BufferedImage(outputWidth, 
outputHeight, image2.getType());
Graphics2D g2 = image2_converted.createGraphics();
g2.drawImage(image2, 0, 0, outputWidth, outputHeight, 
null);
g2.dispose();

image3_converted = new BufferedImage(outputWidth, 
outputHeight, image3.getType());
Graphics2D g3 = image3_converted.createGraphics();
g3.drawImage(image3, 0, 0, outputWidth, outputHeight, 
null);
g3.dispose();
}
else
{

image1_converted = new BufferedImage(width1, height1, 
image1.getType());
Graphics2D g1 = image1_converted.createGraphics();
//System.out.println(g1.getFont().toString());
g1.drawImage(image1, 0, 0, width1, height1, null);
g1.setFont(new Font(Dialog, 2, 200));
g1.drawString(test, width1/2, height1/2);
g1.dispose();

image2_converted = new BufferedImage(width2, height2, 
image2.getType());

[Resin-interest] help on resizing image

2013-02-07 Thread Mattias Jiderhamn
We use JAI in one of our web apps. Have you set system properties 
java.awt.headless=true and java.awt.headlesslib=true ...?

(Btw, for full performance, you should install JNI binaries. Thought 
that wouldn't be 100% Java either. And I haven't tried it.)

  /Mattias

- Original Message -
Subject: [Resin-interest] help on resizing image
Date: Thu, 07 Feb 2013 11:14:00 +0100
From: Riccardo Cohen r.co...@realty-property.com

Hello
On my web application, I need to resize images sent via multipart forms.

When I try a console application using awt on my mac (see attached
code), the console application starts a real Mac application with window
and menu, while my code is only calling non-gui functions
(ImageIO.read...) .

I'm really affraid to add this code on my server, and I wonder if this
may have impact on memory, performance and stability of the server. I
would rather prefer a little imaging library like jmagick or gd for
java, small and efficient. It's not 100% java but it does not create
windows and menus...

What do you use to resize images on the server size ?
Thanks a lot.

-- 
Riccardo Cohen
+33 (0)6 09 83 64 49
Société Realty-Property.com
1 rue de la Monnaie
37000 Tours
France

http://www.appartement-maison.fr


___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest


Re: [Resin-interest] help on resizing image

2013-02-07 Thread Riccardo Cohen
I didn't know about properties java.awt.headless=true. I'll try 
jmagick wich seems to be a good choice for performance.

Thanks a lot



On 07/02/13 11:25, Mattias Jiderhamn wrote:
 We use JAI in one of our web apps. Have you set system properties
 java.awt.headless=true and java.awt.headlesslib=true ...?

 (Btw, for full performance, you should install JNI binaries. Thought
 that wouldn't be 100% Java either. And I haven't tried it.)

/Mattias

 - Original Message -
 Subject: [Resin-interest] help on resizing image
 Date: Thu, 07 Feb 2013 11:14:00 +0100
 From: Riccardo Cohen r.co...@realty-property.com

 Hello
 On my web application, I need to resize images sent via multipart forms.

 When I try a console application using awt on my mac (see attached
 code), the console application starts a real Mac application with window
 and menu, while my code is only calling non-gui functions
 (ImageIO.read...) .

 I'm really affraid to add this code on my server, and I wonder if this
 may have impact on memory, performance and stability of the server. I
 would rather prefer a little imaging library like jmagick or gd for
 java, small and efficient. It's not 100% java but it does not create
 windows and menus...

 What do you use to resize images on the server size ?
 Thanks a lot.


-- 
Riccardo Cohen
+33 (0)6 09 83 64 49
Société Realty-Property.com
1 rue de la Monnaie
37000 Tours
France

http://www.appartement-maison.fr

___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest