Load png image and save it

I am loading a png file and saving it again with following code. The newly created image file is smaller size and poorer quality. How can I retain size and quality of the image?
===========================================
File input = new File(imgFilePath+"img1.png");
BufferedImage im = ImageIO.read(input);
Graphics2D g = im.createGraphics();
File output = new File(imgFilePath+"out2.png");
ImageIO.write(im,"png",output);
===========================================

Would a moderator please change this topic back to not solved.
@Noel: I tried exactly what you said, copying the image to itself so the source and target would be the same size.  It does not work.  I do understand that you respond to many posts and can't actually try to reproduce every issue.   However, in this case, if you did try it on the posted image you would see that the problem is as I described it.
@Acidiclnk: Thank you for reproducing the problem. Unfortunately, I checked your response as the correct answer, but now realize that it does not solve the problem. What you suggest shifts the position of the image from its as loaded position.  Then, as you said, copied images do register with the original.  The problem is, the shifted image no longer lines up with the other maps of my texture.
It took me awhile to find the commands you described, as they are a bit different in my CS4 ("Align Layers to Selection > Vertical Centers", etc).  When I tried them, the pasted image was correctly registered with the original.  Unfortunately, as I mentioned, the image is no longer aligned with the other maps of the texture.
For this particular case, since there were large, uniform areas in the image, I temporarily added fiducial marks to the problem image and one of the other maps.  Then, after copy/paste, I moved the shifted copy until it's fiducial was aligned with the other map, then removed the fiducals.  (I could not use MTSTUNER's Duplicate Layer suggestion, since duplicating it to a new image created a new image with the same problem as the original).
To summarize: PhotoShop loads this image in one position, but aligning the centers or copy/paste moves it to another position.  I would be happy to know why this is so.  I did verfy that it's unique to PhotoShop as copy/paste works without the shift in another graphic editor.  Any insights would be welcome.

Similar Messages

  • Load PNG Images and draw on them.

    I have to load a png image in a JPanel and then draw on this image. How is the way to do it? I've tried several ways but I don't achieve nothing.

    Hi,
    Re:
    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>
    ...I guess the conclusion is even though you can use PL/SQL to get the
    PNG images into the database - like we've done here. There is no real
    point, because one cannot retieve them with standard Java Intermedia
    calls.
    <HR></BLOCKQUOTE>
    On the contrary - I just grabbed a PNG image from our 9i test system, uploaded it using the photo album servlet demo to my 8.1.7 database (which doesn't 'do' PNG) and retrieved it using the same servlet. My Netscape came with the QuickTime Plugin, so the PNG image got displayed as would any other image.
    OK, I admit I had to admit modify the demo a little, but it is just a sample after all, not a full-blown, production web application. For upload, all I had to do was trap the exception raised when it tries to create the thumb-nail. There were 2 changes for retrieval. For the thumb-nail page, if there isn't a thumb-nail, ie getContentLength() == 0, then it displays the text "[view image]" instead of the thumb0nail image. For the full-size page, it only generates the height and width tags if getHeight() and getWidth() both return non-0 values. I didn't have to modify the method that actually delivers the data at all. It just uses the BLOB, MIME type and content length (which you sent when you loaded the image, right?!). The height and width tags aren't required. They just speed things up if present, because the browser knows ahead of time how much space to reserve, so can keep rendering the page, rather than wait for the image to arrive.
    Re:
    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>
    Can't begin to explain how sad this makes me :(
    <HR></BLOCKQUOTE>
    Cheer up! :-)
    Simon
    null

  • How do I take an object from an image and save it so I can use it in other images?

    I am trying to figure out how to take an object from an image and save it so I can re-use it again in other pictures?  I know how to use the magic wand to select the object and place it in a blank image.... but I do not know how to re size the selected object or keep it for later use.  Basically I would like to use the object the same way that I use the graphics ... so I guess I am wondering if there is a way that I can make my own graphics... I have Elements Photoshop 13.  Thanks for any help/advice....  Jerrie

    Hi Jerrie,
    You can re-size using Transformation tool. Ctrl + T will give you a box to re-size the image or object.
    You can save these object as PNG file with Transparent layer. You can use these objects later in another projects.
    Regards,
    Sandeep

  • Load external images and video in edge

    Hi.
    I am looking into edge instead of flash.
    My question is how do you load external images and videos from an external server?
    To clarify, I need to insert a link from where the images can load into the stage, so they don´t take up any of the final weight.
    Thanks in advance.
    Best,
    Stig.

    The above solution I provided works if you already have the images in your composition and than if you want form load images from another server rather than the relative location to your html file.
    Now if you want to load images dynamically into a rectagle containter you will have to code it.
    below is a sample for that
    Create a 'rectangle' with name 'Rectagle'.
    Add the snippet in the compositon ready or on other user actiosn based on your requirement
    var myImagetag = '<img src="http://wwwimages.adobe.com/include/style/default/SiteHeader/logo-2x.png">'
    sym.$("Rectangle").append(myImagetag);

  • Can't load PNG images in CS3

    I'm unable to load PNG images using Photoshop CS3. Whenever I attempt to do so, I get a message saying, "Could not complete your request because it is not the right kind of document."
    Help on this matter would be much appreciated as I am fairly new to using Photoshop.

    I am thinking it is a png file from fireworks.

  • SuperImpose two images and save it as a single image[urgent]

    Hello..
    Can anyone tell me how do we superimpose two images and save it as a single image.The image on the top is smaller in size in my case.
    Please Help..

    import java.awt.Graphics2D;
    import java.awt.image.BufferedImage;
    import java.io.*;
    import javax.imageio.ImageIO;
    import javax.swing.*;
    class TwoBecomeOne {
        public static void main(String[] args) throws IOException {
            BufferedImage large = ImageIO.read(new File("images/tiger.jpg"));
            BufferedImage small = ImageIO.read(new File("images/bclynx.jpg"));
            int w = large.getWidth();
            int h = large.getHeight();
            int type = BufferedImage.TYPE_INT_RGB;
            BufferedImage image = new BufferedImage(w, h, type);
            Graphics2D g2 = image.createGraphics();
            g2.drawImage(large, 0, 0, null);
            g2.drawImage(small, 10, 10, null);
            g2.dispose();
            ImageIO.write(image, "jpg", new File("twoInOne.jpg"));
            JOptionPane.showMessageDialog(null, new ImageIcon(image), "",
                                          JOptionPane.PLAIN_MESSAGE);
    }

  • AppleScript to resize images and save with new name

    I want to make an apple script, which resizes all images of a folder regardless what kind of filetype.
    The source folder will change every day.
    With the script i want to choose a source Folder, resize all images and save the files with my jpeg options in the same folder, but with adding  „_ipad“ in the filename.
    I tried to edit an existing script from this forum, but in Photoshop 5.1 i get the error-message "This function is possibly not available in this Version" in line 18 "save in file newFileName as JPEG with options myOptions"
    How can i save the documents with new name in the existing folder?
    Thanks.
    This is the script i’m working with:
    set inputFolder to choose folder with prompt "Wähle einen Ordner:"
    --set destinationFolder to choose folder with prompt "Wähle einen Zielordner" as string
    tell application "Finder"
              set filesList to (files of entire contents of inputFolder) as alias list
    end tell
    tell application "Adobe Photoshop CS5.1"
              set UserPrefs to properties of settings
              set ruler units of settings to pixel units
              repeat with aFile in filesList
      open aFile showing dialogs never
                        set docRef to the current document
                        tell docRef
                                  set newFileName to my getBaseName(name)
      --resize image height 240 resolution 72 resample method bicubic sharper
      change mode to RGB
      resize image resolution 72
                                  set myOptions to {class:JPEG save options, embed color profile:true, quality:12, format options:progressive, scans:3}
      save in file newFileName as JPEG with options myOptions
                        end tell
      close the current document saving no
              end repeat
              set ruler units of settings to ruler units of UserPrefs
    end tell
    on getBaseName(fName)
              set baseName to fName
              repeat with idx from 1 to (length of fName)
                        if (item idx of fName = ".") then
                                  set baseName to (items 1 thru (idx - 1) of fName) as string
                                  exit repeat
                        end if
              end repeat
              return baseName
    end getBaseName

    This seems like a Photoshop error not an AppleScript one. Have you looked in the Photoshop dictionary to see if the command you are getting the error on exists and if it has those options?
    If all you want to do is resize image files and save the resized image file you might want to look at Automator. Specifically the Scale Image action under Photos.
    regards

  • Trying to create an image and save it on file system

    Hi,
    I'm trying to create an image and save it in the file system :
         public static void main(String[] args) {
         int wid = 632;
         int hgt = 864;
         BufferedImage bufferedImage = new BufferedImage(wid,hgt,BufferedImage.TYPE_INT_RGB);
         bufferedImage.getGraphics().setColor(Color.black);
         bufferedImage.getGraphics().drawOval(30, 30, 100, 100);
              bufferedImage.getGraphics().drawString("test me one two three",2,2);
              bufferedImage.flush();
    try {
                   ImageIO.write(bufferedImage,".bmp",new File("C:/MyImage.bmp"));
         } catch (IOException e) {               
                   e.printStackTrace();
    THE PROBLEM : It creates C:/MyImage.bmp on my file system, but the file is empty (size 0).
    Am I missing something ?
    Thanks

    Try changing ".bmp" to "bmp". If that fails, try posting an SSCCE.
    Edit 1:
    And in future, please use the code tags when posting code, code snippets, HTML/XML or input/output. To do that, select the code and click the CODE button seen on the Plain Text tab of the message posting form.
    Edited by: AndrewThompson64 on Aug 3, 2009 1:23 AM

  • Draw graphics on Image and Save it

    hi!,
    Can anyone help me how to draw graphics(Line, rectangle.ect) on an Image and save it. I need to do the following steps.
    1. Get the Image from the local file system
    2. Based on the parameters i receive for graphics(Ex: rectangle).
    -I have to draw a rectangle on the Image.
    3. Save the Image again to the file system
    I would appreciate if any one has any ideas or sample code I can start with.
    Thanks!!!

    Here's an example using the javax.imageio package.
    import java.awt.Color;
    import java.awt.Graphics2D;
    import java.awt.Rectangle;
    import java.awt.image.BufferedImage;
    import java.io.File;
    import java.io.IOException;
    import javax.imageio.ImageIO;
    public class DrawOnImage {
        public static void main(String[] args) {
            try {
                BufferedImage buffer = ImageIO.read(new File(args[0]));
                Graphics2D g2d = buffer.createGraphics();
                Rectangle rect = new Rectangle(10, 10, 100, 100);
                g2d.setPaint(Color.RED);
                g2d.draw(rect);
                ImageIO.write(buffer, "JPG", new File(args[1]));
            } catch (IOException e) {
                e.printStackTrace();
    }

  • How to scan with capture image and save 10.6.8

    how to scan with capture image and save 10.6.8 ?

    Instructions for using Image Capture for this available via the 2nd section.
    http://support.apple.com/kb/HT2502

  • Cut an image and save each tile to a gif or png

    Hi
    Is it possible to cut a image which contain a lot of 24x24 tiles little image,
    then save each tile to gif or png?
    I whole like to build a map editor. with this function.
    Thanks

    The problem is save seach tile to gif or png.
    I know how to cut the image.
    thanks

  • Loading PNG image file from Applet?

    Hi All,
    My applet running on IE6 and it will often loads 100 PNG image files from a webserver.
    Size of PNG file is about 60Kb so 100*60=6000 Kb ~ 6M.
    In theory, the applet will took 6M of memory to store all 100 files. In practical, it tooks about
    6M* 25 = 150M of memory, that make my applet run in out of memory sometimes.
    I know the reason, may be the brower/applet convert the PNG file format to BMP file format before showing on the screen.
    So the main point here is the applet should not loads all 100 files into the memory,
    it should loads only 10 files at the same time, another 90 files should be cached in memory as PNG file format, not BMP image file format to save the memory usage.
    Is this solution possible in applet field?
    If it is possible how can I implement it?
    And please show me better solution if anys.
    Many Thanks.

    I know the reason, may be the brower/applet convert the PNG file format to
    BMP file format before showing on the screen.This sounds VERY unlikely! Why should the browser do that? And the applet does what you have coded I hope!
    Your problem is probably somewhere else. And it has nothing to do with applets I presume. Use a heap analyzer tool to find out what hogs the memory. A thorough code review can't hurt either. If you still thinks it is the images though, then just don't load them all at once then.

  • Issues loading png images in flex 4.

    For some reason in my application when I use specific PNG images they will not load.  They do not have a high dpi, nor are they very large.  For example : will not load in an mx:Image component, but will.  Does anyone have any idea what the difference between the two would be?
    the mxml I'm using is something like <mx:Image source ="IMG/imagename.png"/> where IMG is a folder in the main directory.  Both images are only stored in those locations yet one will load and the other will not.    
    This is incredibly perplexing to me, and I'd appreciate any assistance.

    I would first try, in your IMG folder, renaming badfile.png to xbadfile.png and then duplicating goodfile.png to badfile.png, without changing any of your code.  Then run it and verify that you do see the png.  I.e. make sure that the problem really is with the png and not with your code somehow.

  • Cut a image and save each tile to a gif

    Hi
    Is it possible to cut a image which contain a lot of 24x24 tiles little image,
    then save each tile to gif or png?
    I whole like to build a map editor. with this function.
    Thanks

    Hi,
    Yes, it is possible.
    You can cut your image thanks to getSubImage (in BufferedImage class).
    About encoding and saving your tiles, take a look at http://www.geocities.com/marcoschmidt.geo/java-image-coding.html
    I hope it could help you.
    Stephane.

  • How to capture an image and save it using action script

    Hello,
    I need to know if is posible to capture an image or a screen region and save it using action scrip.
    Somebody know how to do it ??
    Thanks

    you can capture an image using the bitmapdata class and getPixel().  you can then save that to a bitmap using server-side code like php.

Maybe you are looking for

  • Comparison Sales report by period

    Hi Experts, I am trying to figure out how to create a report for which I have sales figues for one quarter compared to another quarter and then have these compared to the previous year? In other words the report should look like this                 

  • OE:Item Validation Organization - view only your Org Items in SO Item LOV

    HI All, I am trying to set a profile so that I see only the items in my Organization in the Sales Order Item LOV in Order Management when I create a sales order. Appreciate your input to achieve this. Thanks, Jo.

  • Content Management problem

    Hello all, I am working with KM 5.0 SP 5 on two different portal environments, dev and qa. Everything seems to be working fine in qa (we installed there first), but I cannot get content management working in dev. Unfortunately, when we installed in q

  • Reader XI keeps crashing

    I can open my Reader XI version, but before a document fully loads, I get an ap crash message. I've already reinstalled, and used the repair function in help. Any suggestions?

  • Transport personas flavours

    Personas 2.0 1. Is flavours are transportable from dev to QAS to PRD. If yes how it can be achieved.? 2. How the flavours can be assigned to users or user groups? Please advise