Image losing quality when rotating

I tried to do a rotation on my buffered image, however the image loses clarity whenever it tries to rotate the image, can someone help me:
public static BufferedImage rotateImage(BufferedImage image, double degrees) {
          /* assumes 0 <= degrees <= 90 */
          double radians = Math.toRadians(degrees);
          /* get width and height of image to be rotated */
          int width = image.getWidth();
          int height = image.getHeight();
          double w = width * Math.cos(radians);
          double z = width * Math.sin(radians);
          double x = height * Math.sin(radians);
          double y = height * Math.cos(radians);
          int rectWidth = (int) Math.ceil(w + x);
          int rectHeight = (int) Math.ceil(y + z);
          BufferedImage result = new BufferedImage(rectWidth, rectHeight,
                    BufferedImage.TYPE_4BYTE_ABGR);
          AffineTransform transform = new AffineTransform();
          transform.setToTranslation((rectWidth - width) / 2,
                    (rectHeight - height) / 2);
          transform.rotate(radians, width / 2, height / 2);
          Graphics2D g2 = (Graphics2D) result.getGraphics();
          g2.drawImage(image, transform, null);
          return result;
     }

Set RenderingHints on the Graphics2D object. Set
KEY_INTERPOLATION to VALUE_INTERPOLATION_BICUBIC
you could also set
KEY_ANTIALIASING to VALUE_ANTIALIAS_ON
but I don't think that effects rendering images, unless it antialiases their edges.

Similar Messages

  • Problems losing quality when going from develop module to library module ??  anyone have a fix

    Problems losing quality when going to library module from develop module.  Sharpness and color quality decrease

    This is normal. There will be a difference as you are comparing Library Previews with the image in Develop which accesses the original file, although the difference is usually slight. Real results need to be judged from exporting after selecting the output sharpening e.g. for glossy paper, if printing or screen sharpening for web images or emailing.
    The idea with sharpening is to apply capture sharpening so that the image in Develop looks just sharp but not over sharp. Lightroom then uses the correct algorithm for output sharpening based upon image size and quality settings etc.

  • I am losing quality when importing images into ps touch?

    Bringing in 12mp images from Nikon camera and losing quality (blurry edges, low quality, etc).  Is there a setting I can change or is this what we have to deal with on ps touch?

    use the touch forum http://forums.adobe.com/community/creative_cloud_touch_apps/adobe_photoshop_touch

  • Image loses quality when loaded in Java

    Images seem to lose quality when you load them in Java. Try this out to see what I mean... test_out.jpg is smaller than test_in.jpg
    import java.awt.image.BufferedImage;
    import java.io.File;
    import javax.imageio.ImageIO;
    public class ImageTest
        public static void main (String args [])
            BufferedImage img = ImageIO.read (new File ("test_in.jpg"));
            ImageIO.write (img, "JPG", new File ("test_out.jpg"));
    }Is there any way around this? I need to manipulate the image in Java, so I can't just input and output the bytes of the file.

    Well, it's basically cutting the file in half... 1.69
    MB to 862 KB. Doing the same thing in C# keeps the
    file size 1.69 MB (no quality lost), but I want to
    use Java because it's easier to manipulate pictures
    in Java. 800 KB seems a little extreme...There is a lot of difference between no size loss in a file and "no quality loss". Each time you JPG something, some quality is lost even it the size of the file that results is the same as before--it's in the JPS algorithm for comprssion.

  • Illustrator file losing quality when opened in photoshop...please help!

    Hello, If anyone could help me I would be so grateful, i really am struggling to the point of tears here!!
    I have simple line drawings in illustrator (outlines of clothes) that I wish to open in photoshop to add colour and effects to.
    When i have tried to copy and paste (as normal paste, smart object, pixels, path and shape layer) the quality is lost.
    I have also tried to open or place the file in photoshop as a .psd, .ai , .pfd and still the quality is lost.
    I have saved with different resolution settings too, but it always loses quality when it is opened in photoshop.
    Is there any way for me to have a clear line drawing like it is in illustrator in photoshop? And how should I go about it?
    Thank You so much to anyone who can help, I really am at my wits end with this!
    Phoebe xx

    Chris Cox wrote:
    Because the raster on the clipboard would almost never be the right size or resolution. We can't use it.
    Come on, Chris, I'm not buttoned up the back.
    You told me last month when I complained about the poor quality of "paste as pixels" that Photoshop uses the raster in the clipboard so the raster must be poor and not Photoshop's rasterizing of vectors.
    Re: Ps CS6 Problem: Incorrect rendering of pasted Adobe Illustrator vector objects
    Now you say that Photoshop does not use the raster in the clipboard and does rasterize the vectors when "paste as pixels" is performed.
    You can't have it both ways.
    You've just confirmed what I said last month: Photoshop rasterizes the vectors even when pixels are present in the clipboard and "paste as pixels" is requested. Thank you.

  • Why are my photos losing quality when they go online. this has started since i have start using lightroom cc

    since i have started using lightrtoom cc with photoshop 2014 my photo seems to loose colour quality when they are posted online. they look good on my mac but not online. this is an issue i've been having since stared using the new lightroom. help please

    i normally edit my photos in photoshop only but now i've stared using the lightroom cc. I start editing in lightroom then carry on in photoshop. after that i save as a JPEG file. when i look at the photo on the Mac it looks great but when it's on the online portal it looks like the colours faded. For some copyright issues i won't be able to post any photos as they are for clients

  • Losing quality when saving for web after using Multiply

    I have a normal photograph, with a red layer on top set to Multiply/Darken. When I save it for web, regardless of what pixel size, or what uploader I use the quality is terrible.
    Have tried uploading to different services, from difference devices with the same issue, so assume it's a colour profile thing.
    Any help appreciated.
    Image shows the difference in quality compared to normal.

    04dalyj wrote:
    I have a normal photograph, with a red layer on top set to Multiply/Darken. When I save it for web, regardless of what pixel size,
    DPI is pixel size and images are not displayed on screens with the pixels sized as specified in images resolution setting.  The images pixels are displayed on displays with pixels the size the display is run with.  So web images display on display, display with different sizes and resolution depending on the users display device.
    Images saved for web display should be saved with sRGB colors for many image viewers are not color managed and assume web images have sRGB colors.
    So you images will display differently on different displays and no matter how you save them colors will vary  displays may  not be calibrated all displays do not have the same color capabilities.
    The best you can do is calibrate your display and save them with sRGB colors jpeg or png files that display well  and look good on your calibrated display.
    Most desktop displays are 100DPI resolution displays where newer  tablets and laptop have high resolution displays 200 to 300DPI.  Even new Desktop 4k display have lower resolution.  I believe the highest resolution 4K display in production is the Dell 24: display . Its resolution is 185DPI.   Out of production is IBM's old 4K display which had a 204DPI resolution.

  • Losing quality when bringing photos into timeline?

    I am having a major problem with a stop motion project that I am working on. I have imported a folder worth of high quality photos into Final Cut, and when the photos are opened in the Viewer window, the photos appear to be very high quality, as they should. However, when they are put in the timeline, there's a very noticeable loss in quality, and they are also cropped slightly. I have gone through quite a few Sequence Presets, and none of them seem to change the appearance in the slightest. I have invested quite a bit of time in this project so far. Please help!

    polamalu wrote:
    I have no doubt I will lose quality along the way. I am also confident that I can preserve enough quality that your average viewer will not notice much of a difference in quality if at all. Certainly in motion the photos will not look the same, but even when the stills are frozen on the canvas the quality is poor. What settings will provide the best quality for the final product? I will not be able to use blue ray.
    You seem to be thinking the computer or the software must be at fault. Your images are undergoing a reduction in quality that amounts to entire order of magnitude, a factor of 10. You will never put pack what is being lost or be able to create an illusion of fidelity. When you go to the Web, as you indicate later in the thread, your images will be reduced in quality and pixel density by another order of magnitude,70-90% of the already reduced information will be discarded in the form of averaging and reduction of the tonal range to web-safe CLUT.
    bogiesan

  • Images lose quality when imported into Pages

    Hi,
    when I import images into Pages, they lose quality. They are normal jpg files.
    After the import they look a bit fuzzy. I dunno why...
    thanks

    In the Inspector "Measures" there is a button allowing us to reset to the original size.
    Of course, the picture will be smaller than the blurred one
    or
    will be too large and parts will be hidden.
    Yvan KOENIG (from FRANCE mardi 30 juin 2009 12:12:46)

  • Losing quality when exporting

    I've made a slideshow consisting of various stills made in Photoshop (size 1400x1000). When I preview it inside of iMovie it looks just fine, but everytime I export it, it looks blurry. I've tried a lot of different export options and I've tried sharing it with iDVD and burning it to a DVD, but it still looked blurry.
    Can anyone tell me what I have to do to make it export in the same quality as it is when previewed in iMovie?
    Thanks!
    - Rune

    Try searching here: http://mroogle.edesignuk.com/

  • Images losing borders when generated in WebHelp Pro

    Project comes from a linked Frame document. When WebHelp Pro is generated, some of the images lose their borders but not all.
    Re-generation multiple times seems to jump the borders back in.
    The HTML looks fine in comparison with the images that do have their borders.
    Any ideas?

    First off, probably should have posted in the FM Integration forum. Are you using a RH Server to host the output? If not, then don't use WebHelp Pro - it's deliberately created for RH Server hosting. What's different about the images that "work" and those that don't?

  • Aperture 3: Losing quality when exporting to jpg

    I'm downloading raw (nef) images to my hard drive from a Nikon D7000 then importing into Aperture 3. I make changes mostly with Enhance within Aperture 3 and using the Color Efex Pro 4 plug-in. Looks great in Aperture and if I export using any of the tiff options. Quality remains the same. But if I export to jpg (any of the options) or open the tiff in Photoshop Elements and convert to jpg I loose quality. The photo looses sharpness. I have a tif and jpg side by side and the difference is huge. I want to upload to my website so therefore need to use jpg but I'm hating how poor the quality is.
    Any suggestions? I see other people are having similar issues.
    Thanks!

    How are you viewing the exported JPG?  What is the size of the JPG file?
    If you open it in Preview and then go to Tools->Show Inspector you'll get some info on the makeip of the file.
    Here is an example of an exporte JPG at quality 12 and original size:
    Whats your's look like?

  • Losing Quality When Burning in Widescreen ( PLease Help!)

    I edited a video clip using FCE, that I shot in widescreen format(16:9) and when I went to burn to dvd using iDvD, the picture quality is greatly reduced. Is this a problem with the burning software? I was told that I had to get the Final Cut Suite and to use DvD pro to correct these issues. Is this correct or there a way to still utilize iDvd and not have to spend $700+ to get the suite? Any help would be greatly appreciated.

    You might want to try this question on the iDVD forum.

  • PSE 11 images loose quality when dragging since updating to Yosemite

    I make composite images by placing 2 or more images onto a white background, which has always worked well, until I upgraded to the Yosemite OS. Hitherto I have dragged my JPEG image onto the background then dragged a corner handle to reduce the size of the resulting layer. The quality of the layer image had always remained the same after dragging but now, as soon as I drag the image onto the background, the image degrades and becomes pixilated and blocky.
    Any suggestions please?
    Jackie
    27" iMac mid 2011 - 3.4GHz Intel Core i7 - 16GB ram OS X 10.10.1 & PSE 11.0 (20130123.m.34069) downloaded from App Store

    In case anyone is thinking about this -
    It seems this is a symptom of the trackpad problem. Although I only use a few tools, PSE11 is working fine since I disconnected the trackpad. Hopefully the issue will be sorted out soon.
    Thanks to anyone who has spent any time on this.
    Jackie

  • How to I make my animated vector images better quality when exporting to a SWF file?

    I created an interactive PDF and SWF file. My animation only works on the SWF file, but the vector image is low res. On the PDF it doesn't animate (which I know,) but it's high res. However, the SWF file animated, but looks low res. Thoughts?

    Changing text to an image should never be considered since there is no content for the SEO spiders and the images will slow your page download time to a crawl.
    This page shows web safe fonts and also how you need to use hosted fonts if you want something different...
    http://www.iwebformusicians.com/iWeb/Fonts-Colors.html
    The above method uses an HTML snippet and, since this is fairly cumbersome, is only suitable for adding features like special headings. It does allow you to add text shadow using CSS rather than all these wasteful PNG images.
    To use hosted fonts on a whole site you would need to add CSS styles in the head of the HTML doc for every page of your site. But its not low tech and, if you could do this, you wouldn't be using iWeb!

Maybe you are looking for

  • How to add black bars to SIDES of image? Using 'Crop' won't work for this. I explain why.

    I have some clips that are off axis and I applied a bit of tilt to correct them. However, I now need to crop the sides giving me a 1.66:1 effect inside the 1.85:1 frame. But how/ Using CROP in Premiere Pro just crops the image off axis. Here is a scr

  • Using xgrid - shared file system possible?

    I have a question about running a sequence of unix commands with xgrid. I just started fiddling with xgrid and I am already able to run a sequence of renderings in parallel. This is cool and relatively easy. The software I use for rendering is called

  • Re: The specified topic [0] was not found

    I get this error when I click on a link in an email on my iPhone to a thread that I'm monitoring. I don't get the error when I click on the same link from my PC. Does anyone have a workaround? Specifically, it looks like this: Apple Discussions Apple

  • How to route the sounds?

    I want to route a few instuments inputs into one bus then use an insert effect and send it into the main output. any ideas?

  • Use two different classes

    Hi ,thanks a lot for reading this. I would like to create a java class which can perform addition ,namely this program should return the sum of two integers. Then another java class should use the previous one in order to add couples of integers. I k