Re: imageop-block in 2.2

2006-10-25 Thread Niclas Hedhman
On Tuesday 24 October 2006 15:55, Geert Josten wrote:
 Hi Niclas,

   1. Rotation of images will not produce the expected result.
  I never managed to figure out how to make it work, and
  probably need to dig deeper into the Java2D stuff (not my ball game).

 I have been experimenting myself with making the image reading rotate
 images. I added this helper function, that does the tricky part. Note
 that I decided to do rotation in steps of 90 degrees to keep things
 simple.. ;-)

The problems with the rotations are related to;

 a) clipping (can't remember if it happened for N * 90 rotations as well),
 b) 'black' and not 'transparent' in the areas the image no longer occupy.

AffineTransform for rotating any angle is not the problem, but I think one 
need to prepare the space needed before the rotation is executed. I spent 
quite alot of time on it, but in the end we didn't need it so I dropped it 
altogether.


Cheers
Niclas


RE: imageop-block in 2.2

2006-10-25 Thread Geert Josten
 The problems with the rotations are related to;
 
  a) clipping (can't remember if it happened for N * 90 
 rotations as well),
  b) 'black' and not 'transparent' in the areas the image no 
 longer occupy.
 
 AffineTransform for rotating any angle is not the problem, 
 but I think one need to prepare the space needed before the 
 rotation is executed. I spent quite alot of time on it, but 
 in the end we didn't need it so I dropped it altogether.

Yes, the needed space (in terms of pixels) increases considerably when
you rotate for instance 41 degrees. But clipping and background are no
problem when rotating in steps of 90 degrees. All you need to do is
switch height and width if N is not even and leave it like it was if N
is even. :-)

Kind regards,
Geert

PS: I can send you the complete ImageReader if you like, though it is
based on older versions of Cocoon.. (2.1.4/2.1.6)
   
 
Drs. G.P.H. Josten
Consultant
 
 

Daidalos BV
Source of Innovation
Hoekeindsehof 1-4
2665  JZ  Bleiswijk
Tel.: +31 (0) 10 850 1200
Fax: +31 (0) 10 850 1199
www.daidalos.nl
KvK 27164984


De informatie - verzonden in of met dit emailbericht - is afkomstig van 
Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit 
bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit 
bericht kunnen geen rechten worden ontleend.


RE: imageop-block in 2.2

2006-10-24 Thread Geert Josten
Hi Niclas,

  1. Rotation of images will not produce the expected result. 
 I never managed to figure out how to make it work, and 
 probably need to dig deeper into the Java2D stuff (not my ball game).

I have been experimenting myself with making the image reading rotate
images. I added this helper function, that does the tricky part. Note
that I decided to do rotation in steps of 90 degrees to keep things
simple.. ;-)

/**
 * Returns the affine transform that implements the rotating.
 * 0 = no rotation
 * 1 = 90 degrees clockwise
 * 2 = 180 degrees
 * 3 = 90 degrees counterclockwise
 */
private AffineTransform getRotateTransform(int r, double width,
double height) {
/*
A =   0 = (+x, +y)  1,  0,  0,  1
B =  90 = (+y, -x)  0,  1, -1,  0
C = 180 = (-x, -y) -1,  0,  0, -1
D = 270 = (-y, +x)  0, -1,  1,  0

|
  D | A
|
+
|
  C | B
|

Once rotated, the coordinates have to be shifted/translated out of the
negative quadrants into the positive one.
A = 0   0
B = height  0
C = width   height
D = 0   width
*/
r = (r % 4);
if (r == 1) {
// B
return new AffineTransform(0.0d, 1.0d, -1.0d, 0.0d, height,
0.0d);
/* inversion? */
//return new AffineTransform(0.0d, 1.0d, 1.0d, 0.0d, 0.0d,
0.0d);
} else if (r == 2) {
// C
return new AffineTransform(-1.0d, 0.0d, 0.0d, -1.0d, width,
height);
} else if (r == 3) {
// D
return new AffineTransform(0.0d, -1.0d, 1.0d, 0.0d, 0.0d,
width);
} else {
// A
return new AffineTransform(1.0d, 0.0d, 0.0d, 1.0d, 0.0d,
0.0d);
}
}

Never got the time to commit this..

Grtz,
Geert
   
 
Drs. G.P.H. Josten
Consultant
 
 

Daidalos BV
Source of Innovation
Hoekeindsehof 1-4
2665  JZ  Bleiswijk
Tel.: +31 (0) 10 850 1200
Fax: +31 (0) 10 850 1199
www.daidalos.nl
KvK 27164984


De informatie - verzonden in of met dit emailbericht - is afkomstig van 
Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit 
bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit 
bericht kunnen geen rechten worden ontleend.


Re: imageop-block in 2.2

2006-10-24 Thread Lars Trieloff

Hi Nicolas,

I've migrated the block by saturday, with all the pending issues. We  
should add these issues to JIRA.


Lars

Since it was I who contributed it somehmmm... 2(?) years ago, I  
should

actually do it myself now that I am a worthy committer ;o)

Well...

Just want you to know that there are outstanding issues with it. IIRC;

 1. Rotation of images will not produce the expected result. I  
never managed
to figure out how to make it work, and probably need to dig deeper  
into the

Java2D stuff (not my ball game).

 2. Certain types of TIFF encodings will result in incorrect colors  
when
converted. It is not all TIFFs, and I have not even managed to  
figure out

which does and which doesn't work.

 3. Installation of Java Advanced Imaging must be done. Never  
bothered to
figure out if it can be used ad-hoc, or must be installed into the  
JRE as we

did in the project (easiest approach).


But besides that, scaling and conversions of images are lightening  
fast, and
we deployed a couple of 'thumb nail' style photo library sites (NO,  
not porn)

and a product catalog for both web and print.

I got feedback from Stefan Pietschmann, and it might be that he has  
additional

info/changes available...


Cheers
Niclas



--
Lars Trieloff
visit http://www.mindquarry.com/





Re: imageop-block in 2.2

2006-10-23 Thread Niclas Hedhman
On Friday 20 October 2006 17:13, Lars Trieloff wrote:

 In cocoon 2.1 there is an imageop-block that allows more powerful
 image transformations then the standard image reader. It is based on
 a contribution https://issues.apache.org/jira/browse/COCOON-1301 but
 not yet ported to Cocoon 2.2.


Since it was I who contributed it somehmmm... 2(?) years ago, I should 
actually do it myself now that I am a worthy committer ;o)

Well...

Just want you to know that there are outstanding issues with it. IIRC;

 1. Rotation of images will not produce the expected result. I never managed 
to figure out how to make it work, and probably need to dig deeper into the 
Java2D stuff (not my ball game).

 2. Certain types of TIFF encodings will result in incorrect colors when 
converted. It is not all TIFFs, and I have not even managed to figure out 
which does and which doesn't work.

 3. Installation of Java Advanced Imaging must be done. Never bothered to 
figure out if it can be used ad-hoc, or must be installed into the JRE as we 
did in the project (easiest approach).


But besides that, scaling and conversions of images are lightening fast, and 
we deployed a couple of 'thumb nail' style photo library sites (NO, not porn) 
and a product catalog for both web and print.

I got feedback from Stefan Pietschmann, and it might be that he has additional 
info/changes available...


Cheers
Niclas


imageop-block in 2.2

2006-10-20 Thread Lars Trieloff

Hi,

In cocoon 2.1 there is an imageop-block that allows more powerful  
image transformations then the standard image reader. It is based on  
a contribution https://issues.apache.org/jira/browse/COCOON-1301 but  
not yet ported to Cocoon 2.2.


I see Jean-Baptiste started porting, but was unable to finish it, so  
if there are no obections, I will start porting it to cocoon 2.2.


Lars

Lars Trieloff
visit http://www.mindquarry.com/





Re: imageop-block in 2.2

2006-10-20 Thread Vadim Gritsenko

Lars Trieloff wrote:
In cocoon 2.1 there is an imageop-block that allows more powerful image 
transformations then the standard image reader. It is based on a 
contribution https://issues.apache.org/jira/browse/COCOON-1301 but not 
yet ported to Cocoon 2.2.


I see Jean-Baptiste started porting, but was unable to finish it, so if 
there are no obections, I will start porting it to cocoon 2.2.


+1

Vadim