This week's book giveaway is in the Agile forum.
We're giving away four copies of The Software Craftsman and have Sandro Mancuso on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes saving transformed images Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "saving transformed images" Watch "saving transformed images" New topic

saving transformed images

Ethan Gur

Joined: Feb 17, 2005
Posts: 12
Hi all

I'm using awt for rotating images that are kept in DB blobs.
The problem is that when I saved the rotated image to the DB, it appears as if its raster has the wrong dimentions.
The visual affect of this problem is that the image is cut on its wide side, and a black area is added to its narrow side. This is as if after the rotation - the raster turns to a square.

Here is a snippet from the code:

Can anyone help please?
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
Ethan Gur

Joined: Feb 17, 2005
Posts: 12
Thanks Craig - this is the first example that actually works.
However - I still have problems with the rotated image - it seems as if it is rotated around the wrong anchor - I still get the black additions on one side of the image, and it is cut on the other side.

I used either this code:

or this one:

but I still could not create the rotated instance correct...
Ethan Gur

Joined: Feb 17, 2005
Posts: 12
Another thing I wanted to state is that I don't use a container - these images are sent to the web via JSF - this means I had to change your example to remove the panel, and simply work with the byte array.
Consider Paul's rocket mass heater.
subject: saving transformed images