File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Problem with image being cropped and/or not being resized (both) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Problem with image being cropped and/or not being resized (both)" Watch "Problem with image being cropped and/or not being resized (both)" New topic
Author

Problem with image being cropped and/or not being resized (both)

M Ramirez
Greenhorn

Joined: Dec 29, 2013
Posts: 2
So i've been trying for over a day to solve this issue and i'm about to cry lol (ok maybe not that dramatic but close enough).

I'm trying to rotate an image but everytime i try no matter the method or it either truncates or it doesn't resize.

This is what i'm doing in general:

i have an image wich is (let say) 150 x 300 then when i draw it i resize to about 55% of its original size.

but on double click i have to rotate it 90 degrees (goes back and forth to 90 degrees, -horizontal and vertical position-)

and i have tried 2 methods but i get undesired behavior:

this is one:

cardImage is the original full-sized card.
flippedCardImage is where i store the flipped version of cardImage.



with that code i get the image but it is shrinked.

and with this:


with that when i draw it it draws like if i cropped the 55% sized rectangle off the full sized image and draw that instead of resize it.

how do i do rotate and resize it properly can someone please help me? T_T
Tony Docherty
Bartender

Joined: Aug 07, 2007
Posts: 1945
    
  28
Have you read the Java Tutorial on transforming images? see http://docs.oracle.com/javase/tutorial/2d/advanced/transforming.html.
You could also look at this thread http://www.coderanch.com/t/485958/GUI/java/Rotating-buffered-image
Tony Docherty
Bartender

Joined: Aug 07, 2007
Posts: 1945
    
  28
And Welcome to the Ranch.
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2092
    
    7
Post your SSCCE that demonstrates the problem.

The first example looks reasonable, but I don't know the context of how you invoke the and use the resulting image.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with image being cropped and/or not being resized (both)
 
Similar Threads
Image in memory?
Resizing a picture
Rotating a buffered image
Rotating a JWindow with multiple JPanels
Rotating an image